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

Re: How to select elements containing ARPT but not el

Subject: Re: How to select elements containing ARPT but not elements containing APPC_ARPT or ARPT_RMK?
From: "Graydon graydon@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 24 Oct 2022 23:04:35 -0000
Re:  How to select elements containing ARPT but not  el
On Mon, Oct 24, 2022 at 10:51:42PM -0000, Roger L Costello
costello@xxxxxxxxx scripsit:
> Okay, so this for-loop does the job:
> 
> <xsl:for-each select="//row[tokenize(affected_tables,'; ') = 'ARPT'
> ][normalize-space(column_header)]"> <column_header><xsl:value-of
> select="column_header"/></column_header> </xsl:for-each>
> 
> That for-loop solves a problem. Is the problem a specific instance of
> a general problem?

<xsl:sequence select="//row[tokenize(affected_tables,'; ') =
'ARPT'][normalize-space(column_header)]/column_header" />

presumably does the same thing as your for-each example without the
overhead of creating new element nodes.

If you need a different column header element than the one you have,

<xsl:apply-templates select="//row[tokenize(affected_tables,'; ') =
'ARPT'][normalize-space(column_header)]/column_header" />

<xsl:template match="column_header">
... do the thing
</xsl:template>

Will do so. (Possibly employing modes or parameters, if other things
need to happen to other column_header elements.)

for-each is there to handle two special cases; "I need to change the
context item to each of the members of the selected sequence" and
"conceptually, all of these things happen at the same time".  It's not a
loop. (xsl:iterate is closer to being a loop.)  Trying to comprehend
for-each as a loop is unlikely to be helpful.

-- 
Graydon Saunders  | graydonish@xxxxxxxxx
^fs oferiode, pisses swa mfg.
-- Deor  ("That passed, so may this.")

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.