xsl-list
[Top] [All Lists]

Contexts that are atomic values

2005-06-21 15:12:58
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[(_at_)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=(_at_)l!l^!<#]s#[s/0ds^]s(_at_)[p]s&[ddvs^3s!l#x0<&2+l.x]ds.x


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>