Subject: Re: [xsl] Building complex, hierarchical html datasets From: David Carlisle <davidc@xxxxxxxxx> Date: Tue, 19 May 2009 12:16:20 +0100 |
<xsl:choose> <xsl:when test="ancestor::exp-level-1"> <xsl:value-of select="(if (ancestor::exp-level-1/heading[@type = 'electronic-only']) then ancestor::exp-level-1/heading[@type = 'electronic-only'] else ancestor::exp-level-1/heading[@type = 'running-head'])"/> </xsl:when> <xsl:when test="ancestor::misc-level-1"> <xsl:value-of select="ancestor::misc-level-1/heading[1][@type != 'running-head']"/> </xsl:when> <xsl:when test="ancestor::law"> <xsl:value-of select="ancestor::law/heading[@type = 'electronic-only']"/> </xsl:when> <xsl:when test="ancestor::reg"> <xsl:value-of select="(if (ancestor::reg/heading[@type = 'electronic-only']) then ancestor::reg/heading[@type = 'electronic-only'] else ancestor::reg/heading[@type = 'running-head'])"/> </xsl:when> <xsl:when test="ancestor::group"> <xsl:value-of select="(if (ancestor::group[1][not(descendant::misc-level-1 or descendant::exp-level-1)]/heading[@type = 'electronic-only']) then ancestor::group[1]/heading[@type = 'electronic-only'] else ancestor::group[not(descendant::misc-level-1 or descendant::exp-level-1)][heading[1]]/heading[1])"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="parent::*/heading[1]"/> </xsl:otherwise> </xsl:choose> I think that says to choose in order of preference ancestor,exp-level-1,misc-level-1,law,reg,group,any parent then choose in order of prefernce the heading with type electronic-only,running-head, anything which is <xsl:value-of select=" (ancestor::exp-level-1,ancestor::misc-level-1,ancestor::reg,,ancestor::law,ancestor::group,parent::*)[1]/ (heading[@type ='electronic-only'],heading[@type ='running-head'],heading)[1]"/> actually that's not quite the same (for the particularly intricate ancestor::group case but it's neary enough while I'm having lunch... David ________________________________________________________________________ The Numerical Algorithms Group Ltd is a company registered in England and Wales with company number 1249803. The registered office is: Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom. This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. ________________________________________________________________________
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Building complex, hierarc, Mark | Thread | Re: [xsl] Building complex, hierarc, David Carlisle |
Re: [xsl] Building complex, hierarc, Mark | Date | Re: [xsl] Building complex, hierarc, David Carlisle |
Month |