xsl-list
[Top] [All Lists]

Re: [xsl] Referencing unique values by their order number.

2006-12-08 16:59:27
David:

Thanks for the quick answer.

I do not have a separate file - and I'd rather avoid it.  The items are part of 
the same output XML.

Currently all I have is a variable

    <xsl:variable name="items" select="item[not(preceding-sibling::item = .)]"/>

containing the unique item set.

I guess I need some sort of reverse index that maps the value from the 
preceding-sibling::item (the one before the <text> elements) back to the index 
into the 'items' array.  I just don't seem to be able to figure it out in XSLT.

Andreas


----- Original Message ----
From: David Carlisle <davidc(_at_)nag(_dot_)co(_dot_)uk>
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Cc: a5sk4s(_at_)yahoo(_dot_)com
Sent: Friday, December 8, 2006 3:22:25 PM
Subject: Re: [xsl] Referencing unique values by their order number.


If youve already made 

        <items>
                <item>V1</item> <!-- item 0 -->
                <item>V2</item> <!-- item 1 -->
                <item>V3</item> <!-- item 2 -->
        </items>
and put it in file1.xml then

                        <item><xsl:value-of
                        select="'missing-expression'"/></item>
is
                        <item><xsl:value-of 
select="count(doc('file1.xml')/items/item[.=current()]/preceding-sibling::*)"/></item>

as always, keys can be used to speed up this kind of expression.

David


 
____________________________________________________________________________________
Cheap talk?
Check out Yahoo! Messenger's low PC-to-Phone call rates.
http://voice.yahoo.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>
--~--