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

Re: collecting a fileset with XSLT 2.0

Subject: Re: collecting a fileset with XSLT 2.0
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Mon, 06 Feb 2012 15:46:39 -0500
Re:  collecting a fileset with XSLT 2.0
Mark,

This is cool.

On 2/6/2012 12:50 PM, Mark Giffin wrote:
Thanks Wendell, also good to know. In this project I ran out of time and
couldn't take the time to work out how to use collection(), so I handled
it elsewise. collection() would have required a ton of refactoring on
this project. I realized I mainly needed to exclude a couple files, so I
embedded a little lookup table in the stylesheet that holds a couple
strings:

<st:exclude>
<st:file name="filename1.xml"/>
<st:file name="filename2.xml"/>
</st:exclude>

Then I made a key to parse it:

<xsl:variable name="excluded-files"
select="document('')/xsl:stylesheet/st:exclude"/>

Or you could simply do


<xsl:variable name="excluded-files" as="element(st:file)+">
  <st:file name="filename1.xml"/>
  <st:file name="filename2.xml"/>
  ...
</xsl:variable>

and take it from there.

(The hoary old XSLT 1.0 trick you used is no longer necessary. :-)

Then you may not need the key any more either, as

exists($excluded-files[@name=$this-file])

will then tell you what you need to know, probably as fast.

(Many things can become much simpler under 2.0.)

Cheers,
Wendell


<!-- Key to parse $excluded-files. --> <xsl:key name="excluded" match="st:file" use="@name"/>

And excluded those files by testing it with key():

<xsl:when test="exists(key('excluded', $thisfile, $excluded-files))">
<!-- do nothing -->
</xsl:when>

Maybe later I can get cooler with collection().

-- ====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================

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.