f



XSL. howto create an element of a text node?

Hello,

I have a XML file

<car>
<brand>Mercedes</brand>
</car>

I want to transform it to this form:

<car>
<Mercedes>
</car>

So in fact in XSL I want to create an element which has the name of a
text node. This might be a really simple question but I am getting
confused with XPath now, with {}, with // with self:: with parent::
..... :-(

<xsl:template match="car">
<xsl:element name="XXXX"/>
</xsl:template>

How would be the valid XXXX expression?

Thanks for help

Bernd

0
blabla120 (18)
4/3/2006 10:39:52 AM
comp.text.xml 8781 articles. 0 followers. Post Follow

1 Replies
422 Views

Similar Articles

[PageSpeed] 48

blabla120@gmx.net wrote:

> I want to transform it to this form:
>
> <car>
> <Mercedes>
> </car>

I think you mean this  (note the closure of the empty tag)
<car>
<Mercedes/>
</car>


 <xsl:template match="car">
 <xsl:element name="{./brand}"/>
 </xsl:template>

I wouldn't do this though. Dynamically creating new element names is a
whole can of worms and you really don't want to go there.

0
dingbat (860)
4/3/2006 11:06:21 AM
Reply: