|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: conditional position()
On Apr 20, 2005, at 5:08 PM, Dimitre Novatchev wrote:
I know why the above doesn't work, but I'm not sure how to fix it. Am using XSLT 2.0. It means it measures the position in relation to all name elements, rather than just the ones that fit my condition ... The (global) contributor-role variable is: Sorry, was obviously in a hurry. I don't have the code in front of me, but the contributor-role variable returns "primary" if the value of roleTerm matches the list in the primary-contributors variable. Source example would be: My code is a couple/few thousand lines, so am trying to keep it as simple as possible. Let's say I have this document: <doc> <x type="a"/> <x type="b"/> <x type="a"/> <x type="b"/> <doc> How can I only process the x elements with type attribute value of "b", and have position() and last() only apply to those conditions? In other words, how do I trick the processor into thinking the above is: <doc> <x type="b"/> <x type="b"/> <doc> ... such that the second occurrence would have a position of 2, and would be the last? The concrete issue is formatting names. So I need to format all authors, for example, as: Doe, John Doe, John and Jane Smith Doe, John, Jane Smith and James Jones So I need to know the position of any given *author* name. Clearly it would help if my xml was designed differently, but I don't have much control over that. If the above still isn't clear, I'll try to post some templates later. Thanks, Bruce
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








