xsl-list
[Top] [All Lists]

Re: [xsl] Building complex, hierarchical html datasets

2009-05-19 07:16:50



<xsl:choose>
        <xsl:when test="ancestor::exp-level-1">
                <xsl:value-of select="(if 
(ancestor::exp-level-1/heading[(_at_)type =
'electronic-only']) then ancestor::exp-level-1/heading[(_at_)type =
'electronic-only'] else ancestor::exp-level-1/heading[(_at_)type =
'running-head'])"/>
        </xsl:when>
        <xsl:when test="ancestor::misc-level-1">
                <xsl:value-of 
select="ancestor::misc-level-1/heading[1][(_at_)type !=
'running-head']"/>
        </xsl:when>
        <xsl:when test="ancestor::law">
                <xsl:value-of select="ancestor::law/heading[(_at_)type = 
'electronic-only']"/>
        </xsl:when>
        <xsl:when test="ancestor::reg">
                <xsl:value-of select="(if (ancestor::reg/heading[(_at_)type =
'electronic-only']) then ancestor::reg/heading[(_at_)type =
'electronic-only'] else ancestor::reg/heading[(_at_)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[(_at_)type = 'electronic-only']) then
ancestor::group[1]/heading[(_at_)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[(_at_)type ='electronic-only'],heading[(_at_)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. 
________________________________________________________________________

--~------------------------------------------------------------------
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>
--~--