Hello,
I have the following xml elements;
<Person>
<Num>1</Num>
<Name>
<FirstName>Arul</VorName>
<LastName>Raj</NachName>
</Name>
</Person>
I need the following output
<cs attribute="Num" value= "1"/>
<cs attribute="Name" value ="Arul Raj"/>
I have used following XSLT.
<xsl:for-each select="child::*">
<cs>
<xsl:attribute name="attribute">
<xsl:value-of
select="name()"/>
</xsl:attribute>
<xsl:attribute
name="value">
<xsl:choose>
<xsl:when
test="(text()='')">
<xsl:for-each
select="child::*">
<xsl:value-of
select="text()"/><xsl:text>
</xsl:text>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:value-of
select="text()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</cs>
</xsl:for-each>
I am getting following output:
<cs attribute="Num" value="1"/>
<cs attribute="Name"
value=" "/>
How to solve this ?
thanks
regards,
Arul
__________________________________
Do you Yahoo!?
The all-new My Yahoo! - Get yours free!
http://my.yahoo.com
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--