Hi everyone, thanks for the help and all the great responses I've
gleened from ya.
Here we go I got an xml file like so
<!-- AA2 exists -->
<AAA>
<AAA1></AAA1>
<AAA2></AAA2>
<BBB></BBB>
<CCC></CCC>
<BBB></BBB>
</AAA>
<!-- AA2 does not exist -->
<AAA>
<AAA1></AAA1>
<BBB></BBB>
<BBB></BBB>
<CCC></CCC>
</AAA>
Ok, now in a quick pseudo what I need is
<!-- If AA2 does exist -->
<h4>AAA1 AAA2</h4>
<h6>BBB</h6>
<h6>BBB</h6>
<!-- If AA2 does not exist -->
<h4>AA1 BBB</h4>
<h6>BBB</h6>
Here are my current templates
<!-- This template works fine and dandy -->
<xsl:template match="AAA">
<h4>
<xsl:copy-of select="AAA1"/>
<xsl:choose>
<xsl:when test="AAA2"/>
<xsl:copy-of select="AAA2"/>
</xsl:when>
<xsl:otherwise>
<xsl:for-each select="child::BBB">
<xsl:if test="position() = 1">
<xsl:copy-of select="BBB"/>
</xsl:if>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
<h4>
<xsl:apply-templates/>
</xsl:template>
<!-- This is where I get confused -->
<xsl:template match="BBB">
<h6>
<xsl:choose>
<!-- If there is an AAA2 we always put down BBB -->
<xsl:when test="parent::AAA/AAA2">
<xsl:copy-of select="BBB"/>
</xsl:when>
<!-- This doesn't work but it should skip the first BBB and
grab the rest -->
<xsl:when
test="not(count(preceding-sibling::*[name()=name(current())])+1)
= 1">
<p class="sub">(<xsl:copy-of select="subsectionnumber"/>) 
<xsl:copy-of select="subsectiontext"/></p>
</xsl:when>
</xsl:choose>
</h6>
<xsl:apply-templates/>
</xsl:template>
Ok, I think that about covers it, thanks for any help or advice you can offer
Spencer
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--