[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: help with select

Subject: RE: help with select
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 9 Feb 2006 17:03:10 -0000
with select
I haven't studied the question closely but you probably want 

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

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

footnote[@id=./@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.Jiang@xxxxxxxxxxxxxx] 
> Sent: 09 February 2006 16:20
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  help with select
> 
> I'm trying to made the following code work: 
> ./footnote|//footnote[@id=./@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[@id=./@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[@id=./@fnref]) = 1">
> 	        <xsl:apply-templates 
> select="./footnote|//footnote[@id=./@fnref]"/>
> 	     </xsl:when>
> 	 
> 	     <xsl:when 
> test="count(./footnote|//footnote[@id=./@fnref]) &gt; 1">
> 	        <xsl:for-each 
> select="./footnote|//footnote[@id=./@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>

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2011 All Rights Reserved.