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

for-each with included variable

Subject: for-each with included variable
From: "Machelett, Renato (FA.G+M-EP/ETK)" <fa-gm-renato.machelett@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 18 Apr 2001 19:12:09 +0200
renato machelett
Hi Everybody,


I'm not including any XML here, because it would take me a while to locate
and isolate the right part in a few MB of XML and it might still be too
large to post it. If required though, I'll provide it.
I'm dealing with a working piece of legacy XSL that is used for code
generation and looks like this in one part:

<xsl:for-each select="(.//*[@OPTypeRef='Type1'])[1] |
(.//*[@OPTypeRef='Type2'])[1] | (.//*[@OPTypeRef='Type3'])[1]">
  <!-- do some stuff -->
</xsl:for-each>

That is contained in a number of XSL-Files, and of course the number of
comparisons is much larger.
The DTD has changed and so e.g. 'Type1' has now become 'XType1".
Instead of just substituting the occurences everywhere in that stylesheet
I'd rather generalize it, preventing typos and making future changes easier,
by including an XSL-File with the different Types in one variable.

<xsl:variable name="myOPTypeList">XType1,XType2,XType3</xsl:variable>

and applying it like this

<xsl:for-each select="(.//*[@OPTypeRef[contains($myOPTypeList,
@OPTypeRef)]])[1]">
  <!-- do some stuff -->
</xsl:for-each>

Now after the first match no other nodes on the same level are selected -
instead of selecting the first occurence of every type that is present in
that substructure. I'm not familiar enough with XPath to see the solution
myself, and my approach might be wrong in general or not efficient at all.
So any kind of help would be appreciated. My apologies if this should be a
FAQ.


Renato

 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.