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

Contexts that are atomic values

Subject: Contexts that are atomic values
From: Michel Charpentier <charpov@xxxxxxx>
Date: Tue, 21 Jun 2005 18:12:58 -0400
atomic context
Hi,

I need to organize a list of items by genre (@type) so that all the items of a given genre end up in the same file. The following code works:

<xsl:template match="items">
<xsl:for-each select="distinct-values(item/@type)">
<xsl:result-document href="html/{.}.html">
<xsl:apply-templates select="document('music.xml')/ key('by-type',current())"/>
</xsl:result-document>
</xsl:for-each>
</xsl:template>


What bothers me is that I need the 'document("music.xml")' part ('music.xml' is the xml file I'm processing). If I don't have it, Saxon (8B) complains that it cannot process nodes from an atomic context (the string I'm currently processing, I suppose). Same thing if I use //item[@type = current()] instead of a call to key(). So, whether I use key() or not, I still need to start from 'document ("music.xml")' and I don't like it.

Is this behavior normal? Is there a workaround that does not require me to refer to 'music.xml' explicitly?

Thanks,

MC
--
2p3p[dl!d2+s!%0=@l!l^!<#]s#[s/0ds^]s@[p]s&[ddvs^3s!l#x0<&2+l.x]ds.x

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.