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

Re: matching elements of a list

Subject: Re: matching elements of a list
From: Rolf Schumacher <mailinglist@xxxxxxxxx>
Date: Tue, 08 May 2007 23:37:57 +0200
Re:  matching elements of a list
Thank you very much, Jeff.

Worked right away on that sample.
Targeting it to my more complex problem (XMI spec)
is not as easy because the links are not just a sibling.
However with your example I should be able to figure out
how that will work.

Thank you, again

Rolf

Jeff Sese wrote:
> try this stylesheet, i think this would work (if i guessed your
> requirements right).
>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="1.0">
>  <xsl:template match="/">
>    <xsl:apply-templates select="root/st"/>
>  </xsl:template>
>  <xsl:template match="st">
>    <xsl:value-of select="concat(@ix,':')"/>
>    <xsl:apply-templates
> select="following-sibling::ln[@s=current()/@ix]"/>
>    <xsl:text>&#xa;</xsl:text>
>  </xsl:template>
>  <xsl:template match="ln">
>    <xsl:value-of select="concat(' ', @d)"/>
>    <xsl:apply-templates select="following-sibling::ln[@s=current()/@d]"/>
>  </xsl:template>
> </xsl:stylesheet>
>
> -- 
> Jeff
>
>
> Rolf Schumacher wrote:
>> do I have reached the limits of xpath?
>>
>> if several linked lists are contained in one document how to match all
>> nodes belonging to a specific start node?
>>
>> The following example may illustrate my question:
>>
>> Input:
>> <root>
>>     <st ix="a"/>
>>     <st ix="b"/>
>>     <el ix="c"/>
>>     <el ix="d"/>
>>     <el ix="e"/>
>>     <el ix="f"/>
>>     <el ix="g"/>
>>
>>     <ln s="a" d="g"/>
>>     <ln s="g" d="f"/>
>>
>>     <ln s="b" d="e"/>
>>     <ln s="e" d="c"/>
>>     <ln s="c" d="d"/>
>> </root>
>>
>> disired output:
>>
>> a: g f
>> b: e c d
>>
>> How to accomplish that by XSLT (2.0)?
>> Even your answer "I know for sure that there is not elegant way"
>> or "You got to extend the processor by some Java function"
>> would help.

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.