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

RE: Re: xsl-list Digest 28 May 2008 05:10:01 -0000 Iss

Subject: RE: Re: xsl-list Digest 28 May 2008 05:10:01 -0000 Issue 1511
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 28 May 2008 17:48:30 +0100
RE:  Re: xsl-list Digest 28 May 2008 05:10:01 -0000 Iss
> So, your beautifully crafted instruction:
> 
> > <xsl:value-of
> >    select="for $s in $skus return 
> key('sku',$s[document('mySkus.xml')/skus/sku[starts-with(.,$s)
> ]],$root)/name"
> >    separator=", "/>
> 
> leads me to read more on sequence expressions.  I've got to 
> go figure out why the <xsl:for-each> was not the correct way, 
> how the locally defined <$s> variable works, and how the 
> brackets <[]> work.

Some hints:

1. xsl:value-of can output a sequence of values separated by a given
separator (which defaults to a single space)

2. "for $x in SEQ return f($x)" applies some processing to each item in SEQ
in turn, referring to that item as $x

3. $x[predicate], where $x is a single item (which is the case here) returns
either $x or nothing, depending on whether the predicate is true.

4. The predicate here tests whether mySkus.xml contains a sku that starts
with the string $s

5. key('sku', X, $root) searches the tree rooted at $root for a node whose
sku key is equal to X; if X is "nothing" (see 3 above) then key() returns
nothing.

Michael Kay
http://www.saxonica.com/


> 
> Interesting that IE and Firefox fail to transform using the 
> stylesheet where Saxon does it just fine.  I guess they don't 
> have built-in version 2 XSLT and/or XPATH features?... 

Correct, none of the browsers yet support XSLT 2.0.

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.