pvanhelvoirt
Technical User
Hi to all,
I am relatively new to XSL and hope someone can help me.
Using a XSLT I need to transform one XML to another format.
For some reason I don't understand (yet) I can only "read" tags that have a namespace declaration. Tags with no namespace declaration give an empty result. I think there is something wrong in my declarations or in my XPath string. I have included a piece of the XML and my XSL, hopefully you can help me to figger out what I do wrong.
Thanks!
Pieter
XML sample:
[xml]
<EML xmlns="urnasis:names:tc:evs:schema:eml" xmlns:ns2="urnasis:names:tc:ciq:xsdschema:xAL:2.0"
xmlns:ns3="urnasis:names:tc:ciq:xsdschema:xNL:2.0"
xmlns:ns4=" xmlns:ns5="urnasis:names:tc:evs:schema:eml:ts"
xmlns:ns6=" xmlns:ns7=" xmlns:xsi=" Id="230b" SchemaVersion="5"
xsi:schemaLocation="urnasis:names:tc:evs:schema:eml 230-candidatelist-v5-0.xsd http://www.kiesraad.nl/extensions kiesraad-eml-extensions.xsd">
<TransactionId>1</TransactionId>
<IssueDate>2009-10-09</IssueDate>
<ns6:CreationDateTime>2009-10-09T10:00:02.046+02:00</ns6:CreationDateTime>
</EML>
[/xml]
XSL sample:
[xml]
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl=" xmlns="urnasis:names:tc:evs:schema:eml" xmlns:ns2="urnasis:names:tc:ciq:xsdschema:xAL:2.0"
xmlns:ns3="urnasis:names:tc:ciq:xsdschema:xNL:2.0"
xmlns:ns4=" xmlns:ns5="urnasis:names:tc:evs:schema:eml:ts"
xmlns:ns6=" xmlns:ns7=" xmlns:xsi=" version="1.0">
<xsl:template match="/">
<form>
<issueDate>
<xsl:value-of select="/EML/TransactionId"/>
</issueDate>
<creationDate>
<xsl:value-of select="//ns6:CreationDateTime[1]"/>
</creationDate>
</form>
</xsl:template>
</xsl:stylesheet>
[/xml]
I am relatively new to XSL and hope someone can help me.
Using a XSLT I need to transform one XML to another format.
For some reason I don't understand (yet) I can only "read" tags that have a namespace declaration. Tags with no namespace declaration give an empty result. I think there is something wrong in my declarations or in my XPath string. I have included a piece of the XML and my XSL, hopefully you can help me to figger out what I do wrong.
Thanks!
Pieter
XML sample:
[xml]
<EML xmlns="urnasis:names:tc:evs:schema:eml" xmlns:ns2="urnasis:names:tc:ciq:xsdschema:xAL:2.0"
xmlns:ns3="urnasis:names:tc:ciq:xsdschema:xNL:2.0"
xmlns:ns4=" xmlns:ns5="urnasis:names:tc:evs:schema:eml:ts"
xmlns:ns6=" xmlns:ns7=" xmlns:xsi=" Id="230b" SchemaVersion="5"
xsi:schemaLocation="urnasis:names:tc:evs:schema:eml 230-candidatelist-v5-0.xsd http://www.kiesraad.nl/extensions kiesraad-eml-extensions.xsd">
<TransactionId>1</TransactionId>
<IssueDate>2009-10-09</IssueDate>
<ns6:CreationDateTime>2009-10-09T10:00:02.046+02:00</ns6:CreationDateTime>
</EML>
[/xml]
XSL sample:
[xml]
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl=" xmlns="urnasis:names:tc:evs:schema:eml" xmlns:ns2="urnasis:names:tc:ciq:xsdschema:xAL:2.0"
xmlns:ns3="urnasis:names:tc:ciq:xsdschema:xNL:2.0"
xmlns:ns4=" xmlns:ns5="urnasis:names:tc:evs:schema:eml:ts"
xmlns:ns6=" xmlns:ns7=" xmlns:xsi=" version="1.0">
<xsl:template match="/">
<form>
<issueDate>
<xsl:value-of select="/EML/TransactionId"/>
</issueDate>
<creationDate>
<xsl:value-of select="//ns6:CreationDateTime[1]"/>
</creationDate>
</form>
</xsl:template>
</xsl:stylesheet>
[/xml]