J
johkar
New to XSL and in need of assistance. I am building the tags fine
iterating from a to b to c, now just need to keep the values from repeating
if previously matched. Note that within the Extensions nodes, I am only
concerned with those with fieldTypeCode of 10-17. There will be a maximum
of four fieldTypeCode that will meet this criteria.
Thank you
What I want outputted:
<box12a-1>L</box12a-1> <box12a-2>6635.86</box12a-2>
<box12b-1>J</box12b-1> <box12b-2>663.00</box12b-2>
<box12c-1>N</box12c-1> <box12c-2>5.86</box12c-2>
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0" xmlns:xalan="http://xml.apache.org/xslt">
<xslutput method="html" />
<xsl:variable name="TaxRecordNode" select="ptrsTaxRecord/TaxRecord" />
<xsl:variable name="ExtensionNode"
select="$TaxRecordNode/taxDetail/extensions/Extension" />
<xsl:variable name="FieldTypeNode"
select="$TaxRecordNode/taxReturnType/fieldTypes/FieldType" />
<xsl:template match="/">
<html>
<body>
<xsl:apply-templates select="$ExtensionNode">
<xsl:with-param name="minNode">9</xsl:with-param>
</xsl:apply-templates>
</body>
</html>
</xsl:template>
<xsl:template match="Extension">
<xslaram name="minNode" />
<xsl:variable name="num">
<xsl:number count="*" />
</xsl:variable>
<!-- I DID HAVE SOME CODE HERE WHICH VERIFIED THAT FIELDTYPECODE WAS > 9 AND
< 18 -->
<box12
<xsl:number value="$num" format="a" />
-1>
<xsl:value-of select="$FieldTypeNode[fieldTypeCode = *]/description" />
</box12
<xsl:number value="$num" format="a" />
-1> <box12
<xsl:number value="$num" format="a" />
-2>
<xsl:value-of select="$ExtensionNode[fieldTypeCode = *]/reportableAmount" />
</box12
<xsl:number value="$num" format="a" />
-2>
<br />
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0" encoding="UTF-8"?>
<ptrsTaxRecord>
<TaxRecord>
<taxDetail>
<extensions>
<Extension>
<reportableText />
<fieldTypeCode>11</fieldTypeCode>
<reportableAmount>6635.86</reportableAmount>
</Extension>
<Extension>
<reportableText />
<fieldTypeCode>14</fieldTypeCode>
<reportableAmount>663.00</reportableAmount>
</Extension>
<Extension>
<reportableText />
<fieldTypeCode>16</fieldTypeCode>
<reportableAmount>5.86</reportableAmount>
</Extension>
<Extension>
<reportableText />
<fieldTypeCode>20</fieldTypeCode>
<reportableAmount>0.00</reportableAmount>
</Extension>
</extensions>
</taxDetail>
<taxReturnType>
<fieldTypes>
<FieldType>
<description>D</description>
<fieldTypeCode>10</fieldTypeCode>
</FieldType>
<FieldType>
<description>L</description>
<fieldTypeCode>11</fieldTypeCode>
</FieldType>
<FieldType>
<description>Z</description>
<fieldTypeCode>12</fieldTypeCode>
</FieldType>
<FieldType>
<description>G</description>
<fieldTypeCode>13</fieldTypeCode>
</FieldType>
<FieldType>
<description>J</description>
<fieldTypeCode>14</fieldTypeCode>
</FieldType>
<FieldType>
<description>M</description>
<fieldTypeCode>15</fieldTypeCode>
</FieldType>
<FieldType>
<description>N</description>
<fieldTypeCode>16</fieldTypeCode>
</FieldType>
<FieldType>
<description>P</description>
<fieldTypeCode>17</fieldTypeCode>
</FieldType>
</fieldTypes>
</taxReturnType>
</TaxRecord>
</ptrsTaxRecord>
iterating from a to b to c, now just need to keep the values from repeating
if previously matched. Note that within the Extensions nodes, I am only
concerned with those with fieldTypeCode of 10-17. There will be a maximum
of four fieldTypeCode that will meet this criteria.
Thank you
What I want outputted:
<box12a-1>L</box12a-1> <box12a-2>6635.86</box12a-2>
<box12b-1>J</box12b-1> <box12b-2>663.00</box12b-2>
<box12c-1>N</box12c-1> <box12c-2>5.86</box12c-2>
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0" xmlns:xalan="http://xml.apache.org/xslt">
<xslutput method="html" />
<xsl:variable name="TaxRecordNode" select="ptrsTaxRecord/TaxRecord" />
<xsl:variable name="ExtensionNode"
select="$TaxRecordNode/taxDetail/extensions/Extension" />
<xsl:variable name="FieldTypeNode"
select="$TaxRecordNode/taxReturnType/fieldTypes/FieldType" />
<xsl:template match="/">
<html>
<body>
<xsl:apply-templates select="$ExtensionNode">
<xsl:with-param name="minNode">9</xsl:with-param>
</xsl:apply-templates>
</body>
</html>
</xsl:template>
<xsl:template match="Extension">
<xslaram name="minNode" />
<xsl:variable name="num">
<xsl:number count="*" />
</xsl:variable>
<!-- I DID HAVE SOME CODE HERE WHICH VERIFIED THAT FIELDTYPECODE WAS > 9 AND
< 18 -->
<box12
<xsl:number value="$num" format="a" />
-1>
<xsl:value-of select="$FieldTypeNode[fieldTypeCode = *]/description" />
</box12
<xsl:number value="$num" format="a" />
-1> <box12
<xsl:number value="$num" format="a" />
-2>
<xsl:value-of select="$ExtensionNode[fieldTypeCode = *]/reportableAmount" />
</box12
<xsl:number value="$num" format="a" />
-2>
<br />
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0" encoding="UTF-8"?>
<ptrsTaxRecord>
<TaxRecord>
<taxDetail>
<extensions>
<Extension>
<reportableText />
<fieldTypeCode>11</fieldTypeCode>
<reportableAmount>6635.86</reportableAmount>
</Extension>
<Extension>
<reportableText />
<fieldTypeCode>14</fieldTypeCode>
<reportableAmount>663.00</reportableAmount>
</Extension>
<Extension>
<reportableText />
<fieldTypeCode>16</fieldTypeCode>
<reportableAmount>5.86</reportableAmount>
</Extension>
<Extension>
<reportableText />
<fieldTypeCode>20</fieldTypeCode>
<reportableAmount>0.00</reportableAmount>
</Extension>
</extensions>
</taxDetail>
<taxReturnType>
<fieldTypes>
<FieldType>
<description>D</description>
<fieldTypeCode>10</fieldTypeCode>
</FieldType>
<FieldType>
<description>L</description>
<fieldTypeCode>11</fieldTypeCode>
</FieldType>
<FieldType>
<description>Z</description>
<fieldTypeCode>12</fieldTypeCode>
</FieldType>
<FieldType>
<description>G</description>
<fieldTypeCode>13</fieldTypeCode>
</FieldType>
<FieldType>
<description>J</description>
<fieldTypeCode>14</fieldTypeCode>
</FieldType>
<FieldType>
<description>M</description>
<fieldTypeCode>15</fieldTypeCode>
</FieldType>
<FieldType>
<description>N</description>
<fieldTypeCode>16</fieldTypeCode>
</FieldType>
<FieldType>
<description>P</description>
<fieldTypeCode>17</fieldTypeCode>
</FieldType>
</fieldTypes>
</taxReturnType>
</TaxRecord>
</ptrsTaxRecord>