[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[xsl] More on my problem with namespaces
Subject: [xsl] More on my problem with namespaces From: Nick Leaton <nickle@xxxxxxxxx> Date: Tue, 9 Nov 2010 15:59:10 +0000 |
I thought I had a solution to my namespace problem, but on investigation I haven't On further investigation, I haven't got it going, so I've produced a cut down version showing the problem here is a test xml file =================== <?xml version="1.0" encoding="UTF-8"?> <bonds> <isin>123</isin> <isin>456</isin> <isin>789</isin> </bonds> =================== Here is the xslt cut down =================== <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:calypso="http://www.calypso.com/xml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0"> <xsl:output method="xml" indent="yes"/> <xsl:template match="/"> <bonds> <xsl:for-each select="//isin"> <bond> <calypso:secCode> <calypso:name>ISIN</calypso:name> <xsl:element name="calypso:value"> <xsl:attribute name="xsi:type">ns3:string</xsl:attribute> <xsl:attribute name="ns3">http://www.w3.org/2001/XMLSchema</xsl:attribute> <xsl:value-of select="."/> </xsl:element> </calypso:secCode> </bond> </xsl:for-each> </bonds> </xsl:template> </xsl:stylesheet> =================== Here is the output =================== <?xml version="1.0" encoding="UTF-8"?> <bonds xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:calypso="http://www.calypso.com/xml"> <bond> <calypso:secCode> <calypso:name>ISIN</calypso:name> <calypso:value xsi:type="ns3:string" ns3="http://www.w3.org/2001/XMLSchema">123</calypso:value> </calypso:secCode> </bond> <bond> <calypso:secCode> <calypso:name>ISIN</calypso:name> <calypso:value xsi:type="ns3:string" ns3="http://www.w3.org/2001/XMLSchema">456</calypso:value> </calypso:secCode> </bond> <bond> <calypso:secCode> <calypso:name>ISIN</calypso:name> <calypso:value xsi:type="ns3:string" ns3="http://www.w3.org/2001/XMLSchema">789</calypso:value> </calypso:secCode> </bond> </bonds> =================== Here is the desired output =================== <?xml version="1.0" encoding="UTF-8"?> <bonds xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:calypso="http://www.calypso.com/xml"> <bond> <calypso:secCode> <calypso:name>ISIN</calypso:name> <calypso:value xsi:type="ns3:string" xmlns:ns3="http://www.w3.org/2001/XMLSchema">123</calypso:value> </calypso:secCode> </bond> <bond> <calypso:secCode> <calypso:name>ISIN</calypso:name> <calypso:value xsi:type="ns3:string" xmlns:ns3="http://www.w3.org/2001/XMLSchema">456</calypso:value> </calypso:secCode> </bond> <bond> <calypso:secCode> <calypso:name>ISIN</calypso:name> <calypso:value xsi:type="ns3:string" xmlns:ns3="http://www.w3.org/2001/XMLSchema">789</calypso:value> </calypso:secCode> </bond> </bonds> =================== The difference is that I need ns3="http://www.w3.org/2001/XMLSchema" output as xmlns:ns3="http://www.w3.org/2001/XMLSchema" Any ideas? -- Nick
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Retrieving Complete XPATH, Ramkumar.V | Thread | Re: [xsl] More on my problem with n, Michael Kay |
RE: [xsl] Generating XSD Schema fil, Neil Owens | Date | Re: [xsl] More on my problem with n, Michael Kay |
Month |