bananasbananas
IS-IT--Management
how do i get the following structure for my Treeview:
TREENODES
- Item
-- NItem
-- NItem
- Item
-- NItem
- Item
-- NItem
-- NItem
etc
sample of MY XML:
<ItemsHierarchy>
- <Item ConceptId="0">
-- <Name>Business</Name>
-- <NarrowerItems>
--- <Item ConceptId = "238">
--- <Name>Abattoir</Name>
--- </Item>
--- <Item ConceptId = "234">
--- <Name>Pet Shops</Name>
--- </Item>
-- </NarrowerItems>
- </Item>
- <Item ConceptId="1">
-- <Name>Entertainment</Name>
-- <NarrowerItems>
--- <Item ConceptId = "148">
--- <Name>Clubs</Name>
--- </Item>
--- <Item ConceptId = "454">
--- <Name>Bars</Name>
--- </Item>
-- </NarrowerItems>
- </Item>
</ItemsHierarchy>
My current XSLT: (using 'esd' namespace)
<xsl:template match="*">
<TREENODES>
<xsl:for-each select="esd:Item">
<Item>
<xsl:attribute name="Name">
<xsl:value-of select="esd:Name/text()"/>
</xsl:attribute>
<xsl:for-each select="esd:NarrowerItems">
<NItem>
<xsl:attribute name="NName">
<xsl:value-of select="esd:Item/esd:Name/text()"/>
</xsl:attribute>
</NItem>
</xsl:for-each>
</Item>
</xsl:for-each>
<xsl:apply-templates />
</TREENODES>
</xsl:template>
AND the current output for my tree is:
TREENODES
- Item
-- NItem
- TREENODES
-- TREENODES
--- Item
---- NItem
--- TREENODES
---- TREENODES
----- Item
------ NItem
This isn't what i want, but how do i change my XSLT to correct the output?
TREENODES
- Item
-- NItem
-- NItem
- Item
-- NItem
- Item
-- NItem
-- NItem
etc
sample of MY XML:
<ItemsHierarchy>
- <Item ConceptId="0">
-- <Name>Business</Name>
-- <NarrowerItems>
--- <Item ConceptId = "238">
--- <Name>Abattoir</Name>
--- </Item>
--- <Item ConceptId = "234">
--- <Name>Pet Shops</Name>
--- </Item>
-- </NarrowerItems>
- </Item>
- <Item ConceptId="1">
-- <Name>Entertainment</Name>
-- <NarrowerItems>
--- <Item ConceptId = "148">
--- <Name>Clubs</Name>
--- </Item>
--- <Item ConceptId = "454">
--- <Name>Bars</Name>
--- </Item>
-- </NarrowerItems>
- </Item>
</ItemsHierarchy>
My current XSLT: (using 'esd' namespace)
<xsl:template match="*">
<TREENODES>
<xsl:for-each select="esd:Item">
<Item>
<xsl:attribute name="Name">
<xsl:value-of select="esd:Name/text()"/>
</xsl:attribute>
<xsl:for-each select="esd:NarrowerItems">
<NItem>
<xsl:attribute name="NName">
<xsl:value-of select="esd:Item/esd:Name/text()"/>
</xsl:attribute>
</NItem>
</xsl:for-each>
</Item>
</xsl:for-each>
<xsl:apply-templates />
</TREENODES>
</xsl:template>
AND the current output for my tree is:
TREENODES
- Item
-- NItem
- TREENODES
-- TREENODES
--- Item
---- NItem
--- TREENODES
---- TREENODES
----- Item
------ NItem
This isn't what i want, but how do i change my XSLT to correct the output?