xsl-list
[Top] [All Lists]

[xsl] XPath location problem

2006-08-29 15:09:14
Hi,
First, I want to thank Michael and Peter for your help on my question about sort order last week. My problem then was solved with the node-set extension.

My new problem is a location issue. On the XML document:
       <animal>
           <species>
               <name language="English">Wolf</name>
               <name language="Spanish">Lobo</name>
               <name language="English">Warg</name>
               <name language="Latin">Canis Lupus</name>
               <name language="French">Loup</name>
           </species>
       </animal>

I want to perform this operation: If there is more than one "name language='English'" in "species", then create a temporary node set with the "name" elements following and including the second "language='English'". Thus,
        <name language="English">Wolf</name>
       <name language="Spanish">Lobo</name>
       <name language="English">Warg</name>
       <name language="Latin">Canis Lupus</name>
       <name language="French">Loup</name>
should be
       <name language="English">Warg</name>
       <name language="Latin">Canis Lupus</name>
       <name language="French">Loup</name>

The new node set should then be placed in a variable and compared to another "species" node set, but I think I can sort that part out for myself. Is it possible to extract my wanted output with XPath? There can be any number of "name language='English'", and they can be in any position, so the solution must be generic. I work with XSL 1.0 and the Xalan processor.

Thanks in advance!
Per


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