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

RE: template match : node-set paring through multiple-

Subject: RE: template match : node-set paring through multiple-axis relationships
From: Américo Albuquerque <melinor@xxxxxxx>
Date: Tue, 3 Jun 2003 21:54:26 +0100
xsl select two conditions
Hi.

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> Jonathan Sprinkle
> Sent: Tuesday, June 03, 2003 6:35 PM
> To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'
> Subject: RE:  template match : node-set paring through 
> multiple-axis relationships
> 
> 
> From message
> (http://www.biglist.com/lists/xsl-list/archives/200305/msg01198.html)
> 
> Discouraged by XSL's limitations, I gave up doing it the nice 
> way and hacked my own solution.  In case you care, here it 
> is.  It is a pain in the bum, because now I have to create a 
> bunch of variables, and do my own name mangling if I have two 
> different things to do to a 'b' in two different contexts 
> because XSL's namespace is intuitively different from 
> conventional namespaces in C++.  However, it works, and I can 
> generate it generically from a graphical transformation language.
> 
> For those who are in charge, and using this list to educate 
> others on XSL to evangelise it to the world on XSL and its 
> usage, I am disappointed that no one responded to my request, 
> even to say "boy, that sure is a different problem".  :(
> 

I try to but had some promlems in my email acount.

If I understand you correct you want to match a node 'b' based on two
conditions. It's easier if you select only those you want instead of
matching them

Try this:
 <!-- get all 'b's -->
 <xsl:key name="Bs" match="b" use="'B'"/>
 
 <xsl:template match="root">
  <doc>
  <xsl:apply-templates select="c"/>
  </doc>
 </xsl:template>
 
 <xsl:template match="b">
  <comment>Matched B...<xsl:value-of select="@id"/></comment>
 </xsl:template>

 <xsl:template match="c">
  <xsl:variable name="src" select="c1[@role='src']/@target"/>
  <xsl:variable name="dst" select="c1[@role='dst']/@target"/>
  <!-- select the 'b' nodes with id=$src and with parent 'a' that
doesn't have another 'a' as ancestor -->
  <xsl:apply-templates
select="key('Bs','B')[@id=$src][key('Bs','B')[@id=$dst]/parent::a[not(an
cestor::a)]]"/>
 </xsl:template>


Hope this helps you.
(...)



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.