Hi all,
I am attempting to filter an xml file from a .net application to produce another xml file, with little success. Sample xml below, not the proper xml, but similar:
="1.0"="UTF-8"="yes"
<Root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Row A1="1" A2="AMS">
<Name>Ashley</Name>
<Team>Team B</Team>
<Date>3/25/2012</Date>
<Value>511681.15</Value>
</Row>
<Row A1="2" A2="AMS">
<Name>Kylie</Name>
<Team>Team A</Team>
<Date>9/28/2010</Date>
<Value>408438.47</Value>
</Row>
<Row A1="3" A2="AMS">
<Name>Gianna</Name>
<Team>Team B</Team>
<Date>40004</Date>
<Value>109709.22</Value>
</Row>
The XSLT:
="1.0"="UTF-8"
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common" extension-element-prefixes="exsl" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
<xsl:output method="xml" indent="yes" encoding="UTF-8" />
<xsl:decimal-format name="NN" NaN="0" />
<xsl:param name="Filter" />
<xsl:template match="/">
<Root>
<xsl:for-each select="exsl:node-set($Filter)">
<Row>
<xsl:attribute name="A1">
<xsl:value-of select="@A1" />
</xsl:attribute>
<xsl:attribute name="A2">
<xsl:value-of select="@A2" />
</xsl:attribute>
<Team>
<xsl:value-of select="Team"/>
</Team>
</Row>
</xsl:for-each>
</Root>
</xsl:template>
The filter I pass to the parameter could be using any combination of the xml elements. The filter I am testing with at the moment is
//Row[Team='Team B']
But this just results in an xml file being produced with empty tags, as below.
="1.0"="utf-8"
<Root>
<Row A1="" A2="">
<Team></Team>
</Row>
</Root>
I know i have to use the node-set function, but am i using it in the correct place? Any pointers or suggestions appreciated.
Thanks