xsl-list
[Top] [All Lists]

RE: help with select

2006-02-09 10:03:10
I haven't studied the question closely but you probably want 

footnote[(_at_)id=current()/@fnref]

Note that ./@fnref means the same as @fnref, so

footnote[(_at_)id=(_dot_)/@fnref]

looks for a footnote whose id and fnref attributes have the same value.

Following cross-references is often best done using keys: it's certainly
more efficient and many people say the code is clearer. Look up xsl:key.

Michael Kay
http://www.saxonica.com/

-----Original Message-----
From: Jiang, Peiyun 
[mailto:Peiyun(_dot_)Jiang(_at_)nrc-cnrc(_dot_)gc(_dot_)ca] 
Sent: 09 February 2006 16:20
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] help with select

I'm trying to made the following code work: 
./footnote|//footnote[(_at_)id=(_dot_)/@fnref]

I want to select the child footnote element of author and any 
footnote that its id attribute matches the fnref attribute of 
the author.
 
In footnote[(_at_)id=(_dot_)/@fnref], is "." referring to author or to 
footnote? How do you refer author?

Thanks.

Peiyun


<xsl:template match="author">
    <!-- something here -->
           <xsl:choose>
           <xsl:when 
test="count(./footnote|//footnote[(_at_)id=(_dot_)/@fnref]) = 1">
              <xsl:apply-templates 
select="./footnote|//footnote[(_at_)id=(_dot_)/@fnref]"/>
           </xsl:when>
       
           <xsl:when 
test="count(./footnote|//footnote[(_at_)id=(_dot_)/@fnref]) &gt; 1">
              <xsl:for-each 
select="./footnote|//footnote[(_at_)id=(_dot_)/@fnref]">
                  <xsl:choose>
                     <xsl:when test="position() = last()">
                        <xsl:apply-templates select="." /> 
                     </xsl:when>
                     <xsl:when test="position() != last()">
                        <xsl:apply-templates select="." />
                        <sup>,<xsl:text>&#x20;</xsl:text></sup>
                     </xsl:when>                      
                  </xsl:choose>
              </xsl:for-each>
           </xsl:when>             
           </xsl:choose>

  <!-- some other things here -->
</xsl:template>


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





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



<Prev in Thread] Current Thread [Next in Thread>