XSLT Atrtibute价值 [英] XSLT Atrtibute Value

查看:55
本文介绍了XSLT Atrtibute价值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找以下问题的解决方案:

我生成的XML文档就像


< .... >

< struct name =" number" type =" PartNumber"> 100< / struct>

< struct name =" identity" type =" PartIdentity"> 1< / struct>

< enum name =" ex_identity" type =" .....">< / enum>

< ....>


现在我想要使用XSLT文件创建一个新的结构化XML文件,例如


< ....>

< number sort =" struct" type =" PartNumber"> 100< / struct>

< identity sort =" struct" type =" PartIdentity"> 1< / struct>

< ex_identity sort =" enum" type =" ........


我的问题是,我无法读出该属性的价值

"命名"所以我不能

创建它的新元素。此外,我需要为新元素创建其他

属性,或者我可以轻松地复制它们(?)。

有人有任何解决方案吗? PLZ帮我搜索了很长时间。


Big THX parvus

Hi, I′m searching a solution for the following problem:
I′ve a generated XML Document like

<....>
<struct name="number" type="PartNumber">100</struct>
<struct name="identity" type="PartIdentity">1</struct>
<enum name="ex_identity" type="....."></enum>
<....>

Now i want to use a XSLT file to create a new structured XML file like

<....>
<number sort="struct" type="PartNumber">100</struct>
<identity sort="struct" type="PartIdentity">1</struct>
<ex_identity sort="enum" type="........

My problem ist, that i couldn′t read out the value of the attribute
"name" so i can′t
create a new element of it. Furthermore i need to create the other
attributes for the new element or maybe i can copy them easily(?). Does
anybody have any solution? PLZ help me im searching for a long time.

Big THX parvus

推荐答案

parvus写道:

[...]
parvus wrote:
[...]
现在我想使用XSLT文件创建一个新的结构化XML文件,如

< ....>
< number sort =" struct" type =" PartNumber"> 100< / struct>
< identity sort =" struct" type =" PartIdentity"> 1< / struct>
< ex_identity sort =" enum" type =" ........
Now i want to use a XSLT file to create a new structured XML file like

<....>
<number sort="struct" type="PartNumber">100</struct>
<identity sort="struct" type="PartIdentity">1</struct>
<ex_identity sort="enum" type="........



[...]

使用枚举是一个好主意。但上面的格式不是很好。

也许你想要别的东西?


[...]
Using enum is a good idea. But the above is not well formed XML.
Maybe you want something else?


在文章< 11 ******* ***************@z14g2000cwz.googlegroups .com> ;,

parvus< pa ****** @ web.de>写道:
In article <11**********************@z14g2000cwz.googlegroups .com>,
parvus <pa******@web.de> wrote:
< struct name =" number"类型= QUOT; PARTNUMBER"> 100℃; /结构>
< number sort =" struct" type =" PartNumber"> 100< / struct>
<struct name="number" type="PartNumber">100</struct> <number sort="struct" type="PartNumber">100</struct>




你想要类似的东西


< xsl:element名称= QUOT; {@名称}"> ......


- Richard



You want something like

<xsl:element name="{@name}"> ...

-- Richard


我正在搜索以下问题的解决方案:
我生成的XML文档如

< ....>
< struct name =" number" type =" PartNumber"> 100< / struct>
< struct name =" identity" type =" PartIdentity"> 1< / struct>
< enum name =" ex_identity" type =" .....">< / enum>
< ....>

现在我想使用XSLT文件创建一个新的结构化XML文件,如

< ....>
< number sort =" struct" type =" PartNumber"> 100< / struct>
< identity sort =" struct" type =" PartIdentity"> 1< / struct>
< ex_identity sort =" enum" type =" ........

我的问题是,我无法读出属性
name的值。所以我不能创建它的新元素。


为什么你不能? < element name =" {@ name}" />不工作?


此外我需要为新元素创建其他属性,或者我可以轻松复制它们(?)。有没有人有任何解决方案? PLZ帮我搜索了很长时间。
Hi, I′m searching a solution for the following problem:
I′ve a generated XML Document like

<....>
<struct name="number" type="PartNumber">100</struct>
<struct name="identity" type="PartIdentity">1</struct>
<enum name="ex_identity" type="....."></enum>
<....>

Now i want to use a XSLT file to create a new structured XML file like

<....>
<number sort="struct" type="PartNumber">100</struct>
<identity sort="struct" type="PartIdentity">1</struct>
<ex_identity sort="enum" type="........

My problem ist, that i couldn′t read out the value of the attribute
"name" so i can′t
create a new element of it.
Why couldn''t you? Does <element name="{@name}"/> not work?

Furthermore i need to create the other attributes for the new element or maybe i can copy them easily(?). Does
anybody have any solution? PLZ help me im searching for a long time.




< attribute name =" sort">< value-of select =" local-name( )" />< / attribute>


Soren



<attribute name="sort"><value-of select="local-name()"/></attribute>

Soren


这篇关于XSLT Atrtibute价值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆