I have an xml document and the it's made up like this:
Expand|Select|Wrap|Line Numbers
- <Catalogue>
- <ProdID>1</ProdID>
- <ProdDescription>Bristol Fixture HP Sodium</ProdDescription>
- <ProdPartNo>AP-0207</ProdPartNo>
- <ProdTypeID>3</ProdTypeID>
- <ProdTypeDescription>Ornamental</ProdTypeDescription>
- <ProdCatID>2</ProdCatID>
- <ProdCatDescription>Lighting Fixtures</ProdCatDescription>
- <ProdSubCatID>4</ProdSubCatID>
- <ProdSubCatDescription>Bristol Series Fixtures</ProdSubCatDescription>
- <PDFFileName>O2-Renaissance Fixture.pdf</PDFFileName>
- </Catalogue>
I have gotten it to the point where I can get the first categories to list with each entry under them, but can't get the second to work.
Here's the code I have so far:
Expand|Select|Wrap|Line Numbers
- <xsl:template match="/">
- <!-- consider all ProdCatDescription, one by one, sorted, no double -->
- <xsl:for-each select="/NewDataSet/Catalogue/ProdCatDescription[not(../preceding-sibling::Catalogue/ProdCatDescription = .)]">
- <xsl:sort/>
- <xsl:call-template name="handle-ProdCatDescription">
- <xsl:with-param name="ProdCatDescription" select="."/>
- </xsl:call-template>
- </xsl:for-each>
- </xsl:template>
- <!-- display all ProdCatDescription for a give Catalogue -->
- <xsl:template name="handle-ProdCatDescription">
- <xsl:param name="ProdCatDescription"/>
- <xsl:variable name="Catalogues" select="/NewDataSet/Catalogue[ProdCatDescription = $ProdCatDescription]"/>
- <H3>
- <xsl:value-of select="$ProdCatDescription"/>, contains <xsl:value-of select="count($Catalogues)"/> Products.
- </H3>
- <xsl:for-each select="$Catalogues">
- <xsl:sort select="ProdSubCatDescription"/>
- <xsl:sort select="ProdPartNo"/>
- <xsl:value-of select="ProdSubCatDescription"/> :: <xsl:value-of select="ProdPartNo"/>
- <br/>
- </xsl:for-each>
- </xsl:template>
Expand|Select|Wrap|Line Numbers
- Main Category Name 1
- Sub Category Name 1 :: Product Part Number
- Sub Category Name 1 :: Product Part Number
- Sub Category Name 2 :: Product Part Number
- Main Category Name 2...etc...
Expand|Select|Wrap|Line Numbers
- Main Category Name 1
- Sub Category Name 1
- Product Part Number
- Product Part Number
- Sub Category Name 2
- Product Part Number
- Main Category Name 2...etc...