How to copy all fields from xml to xslt?



How to copy all fields from xml to xslt except the field name="Category"? I use



Field[not(name()='Category')]


But when I preview the result, it display only the field name="Category" instead of displaying the all field.


XML:



<Form name="Form1" type="TextView" label="Cash Pickup Form">

<Field name="Category" type="TextView" label="FormType" value="Form1"/>

<Field type="Delimiter"/>
<Field name="ContractNumber" type="TextView" label="Contract number" value=""/>
<Field type="Delimiter"/>
<Field name="ClientName" type="TextView" label="Name of Client" value=""/>
<Field name="BirthDate" type="TextView" label="Birthday" value=""/>
<Field name="DueDate" type="TextView" label="Due Date" value=""/>
</Form>


XSLT:



<xsl:variable name="Category" select="/Form/Field[@name='Category']/@value"/>
<xsl:template match="/">
<xsl:apply-templates select="Form"/>
</xsl:template>

<xsl:template match="Form">
<xsl:element name="Form">
<xsl:attribute name="name">
<xsl:value-of select="@name"/>
</xsl:attribute>
<xsl:attribute name="type">
<xsl:value-of select="@type"/>
</xsl:attribute>
<xsl:attribute name="label">
<xsl:value-of select="@label"/>
</xsl:attribute>
<xsl:copy-of select="namespace::*[not(name()='ns2') and not(name()='')]"/>
<xsl:call-template name="Arrange"/>
</xsl:element>
</xsl:template>

<xsl:template name="Arrange">
<xsl:apply-templates select="Field[not(name()='Category')]"/>
</xsl:template>
</xsl:stylesheet>

No comments:

Post a Comment