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

Re: conditional position()

Subject: Re: conditional position()
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Thu, 21 Apr 2005 07:08:02 +1000
xsl current position
On 4/21/05, Bruce D'Arcus <bdarcus@xxxxxxxxx> wrote:
> Hi All,
>
> Been away wrapping up a book that I'm formatting with the XSLT code
> that I developed with much help from this list.  Alas, there's still
> work to be done there.
>
> How do I get this position() function to apply only to only certain nodes?
>
> Here's my expression:
>
> <xsl:when test="$contributor-role='primary' and position() = last()"/>

This is OK syntactically. Of course, position() has only meaning for
the context item in the current context  -- what is the current
context is not clear from the above one-line excerpt.


>
> I know why the above doesn't work, but I'm not sure how to fix it. Am
> using XSLT 2.0.

What does "doesn't work" means?

>
> The (global) contributor-role variable is:
>
> <xsl:variable name="primary-contributors" select="('author', 'editor',
> 'creator', 'reporter')"/>

Sorry, but this variable is named "primary-contributors", not
"contributor-role".

>
> Source example would be:
>
> <name type="personal">
>  <namePart type="given">Jane</namePart>
>  <namePart type="family">Doe</namePart>
>  <role>
>    <roleTerm>translator</roleTerm>
>  </role>
> </name>
> <name type="personal">
>  <namePart type="given">Jane</namePart>
>  <namePart type="family">Doe</namePart>
>  <role>
>    <roleTerm>author</roleTerm>
>  </role>
> </name>
> <name type="personal">
>  <namePart type="given">John</namePart>
>  <namePart type="family">Smith</namePart>
>  <role>
>    <roleTerm>translator</roleTerm>
>  </role>
> </name>
>
> The position of the second name element with the author role should be
> '1' and it should  be 'true' for last().  In other words, processing
> should completely ignore the name elements that contain roles other
> than those that are "primary."

Not clear. Could you, please, define more precisely?



Cheers,

Dimitre Novatchev.

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-2013 All Rights Reserved.