xml - need help on xslt transformations regarding the namespaces -
i working on xslt transformations. stuck @ 1 point.
source xml:
<?xml version="1.0" encoding="iso-8859-1"?> <content xmlns="uuid:4522eb85-0a47-45f9-8e2b-1f82c78fa920"> <first xmlns="uuid:4522eb85-0a47-45f9-8e2b-1f82c78fa920">hello world.this fisrt field</first> <second xmlns="uuid:4522eb85-0a47-45f9-8e2b-1f82c78fa920">hello world.this second field2</second> </content>
output format required:
<aaa>hello world.this fisrt field</aaa> <bbb>hello world.this second field</bbb>
please suggest solution this.
i have tried this
<?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns="uuid:4522eb85-0a47-45f9-8e2b-1f82c78fa920"> <xsl:output method="xml" indent="yes"/> <xsl:template match="/"> <aaa> <xsl:value-of select="content/first"/> </aaa> </xsl:template> </xsl:stylesheet>
output got is
<?xml version="1.0" encoding="utf-8"?> <aaa xmlns="uuid:4522eb85-0a47-45f9-8e2b-1f82c78fa920"></aaa>
output required is
<aaa>hello world.this fisrt field</aaa>
here's 1 want, sort of, see comments below.
<?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:x="uuid:4522eb85-0a47-45f9-8e2b-1f82c78fa920"> <xsl:output method="xml" indent="yes"/> <xsl:template match="/"> <xsl:element name="root"> <xsl:element name="aaa"> <xsl:value-of select="x:content/x:first"/> </xsl:element> <xsl:element name="bbb"> <xsl:value-of select="x:content/x:second"/> </xsl:element> </xsl:element> </xsl:template> </xsl:stylesheet>
while xslt processors allow have more 1 root element in result, isn't advisable contradicts syntactically standard.
Comments
Post a Comment