tags:

views:

19

answers:

1

Problem I have is I want to loop round the parents making them bold then get the children via the id:pid (parent id) and list them. My second loop doesn't work.

XML

XSL

<xsl:choose>
 <xsl:when test="@PARENT_OBH_ID">

<b><xsl:value-of select="@TITLE"/></b>

<xsl:for-each select="FOOTER">
   -<xsl:value-of select="@TITLE"/>
</xsl:for-each>


 </xsl:when>
</xsl:choose>

</xsl:for-each>

Thanks

A: 

You're probably better off restructuring this to use templates, the system you're using at the moment means that the context data is becoming confused (you're xslt parser isn't sure which element it should read attributes from inside the second loop)

<xsl:choose>
 <xsl:when test="@PARENT_OBH_ID">
   <b><xsl:value-of select="@TITLE"/></b>
   <xsl:apply-templates select="FOOTER" />
 </xsl:when>
</xsl:choose>

<xsl:template match="FOOTER">
    <xsl:value-of select="@TITLE"/>
</xsl:template>

apply-templates restarts the context with the footer element as the main focus (so @TITLE refers to the title attribute on footer, which is what you were aiming for I am guessing?)

Ceilingfish