Here my XML doc :
<?xml version="1.0" ?>
<ArrayOfPrimitiveParameter xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<PrimitiveParameter>
<Name>field</Name>
<Value xsi:type="xsd:string">TNA</Value>
</PrimitiveParameter>
<PrimitiveParameter>
<Name>date</Name>
<Value xsi:type="xsd:dateTime">2011-12-14T00:00:00</Value>
</PrimitiveParameter>
</ArrayOfPrimitiveParameter>
And I want to transform its structure in :
TNA 2011-12-14T00:00:00
for the moment, I wrote this :
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/TR/REC-html40"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>
<xsl:output method="xml" encoding="utf-8"/>
<xsl:template match="/">
<Parameters>
<xsl:apply-templates/>
</Parameters>
</xsl:template>
<xsl:template match="ArrayOfPrimitiveParameters">
<!-- String -->
<xsl:if test="PrimitiveParameter/@xsi:type = 'xsd:string'">
<StringParameter>
<xsl:attribute name="name">
<xsl:value-of select='PrimitiveParameter/name' />">
</xsl:attribute>
<xsl:value-of select='PrimitiveParameter/value'/>
</StringParameter>
</xsl:if>
<!-- DateTime -->
<xsl:if test="PrimitiveParameter/@xsi:type = 'xsd:dateTime'">
<DateParameter>
<xsl:attribute name="name">
<xsl:value-of select='PrimitiveParameter/name' />">
</xsl:attribute>
<xsl:value-of select='PrimitiveParameter/value'/>
</DateParameter>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
but the output of my XML is that :
<?xml version="1.0" encoding="utf-8"?><Parameters xmlns="http://www.w3.org/TR/REC-html40" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
field
TNA
date
2011-12-14T00:00:00
</Parameters>
Thank you for your help,
Florian