xsl-list
[Top] [All Lists]

xpath:document - how to access elements from all xsl:include referencing documents

2005-01-21 13:47:51
Is it possible to access elements from multiple documents which
reference the current xslt document when you don't know the
reference-uri for each document?

I would like something like this:
xpath:document(xx:get-all-referencing-uri()) where
xx:get-all-referencing-uri returns a NodeList of URIs for all documents
which included this document.

Is there a way to access elements from all the referencing documents?

Here is an example of what I am trying to do, which fails:

java org.apache.xalan.xslt.Process -XSL a.xslt -OUT result.txt

This is the main script which uses the library script b.xslt.
a.xslt {
<xsl:stylesheet version="1.0" 
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
        xmlns:xalan="http://xml.apache.org/xalan";
        xmlns:t="test"

        <t:d>a stuff</t:d>
        <xsl:include href="b.xslt" /> 
        <xsl:output method="text" indent="yes" />
</xsl:stylesheet>
}

This is a library script which extends c.xslt.
b.xslt {
<xsl:stylesheet version="1.0" 
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
        xmlns:xalan="http://xml.apache.org/xalan";
        xmlns:t="test"

        <t:d>b stuff</t:d>
        <xsl:include href="c.xslt" /> 
        <xsl:template match="/">
                <xsl:for-each
select="xalan:nodeset($all-d-elements)/t:d">
                        <xsl:value-of select="." />
                        <xsl:text>&#10;</xsl:text>
                </xsl:for-each>
        </xsl:template>
</xsl:stylesheet>
}

This is a generic library xslt which grabs all the <t:d> elements from
all the scripts which have included it (or imported, whichever works).
c.xslt {
<xsl:stylesheet version="1.0" 
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
        xmlns:xalan="http://xml.apache.org/xalan";
        xmlns:t="test"

        <t:d>c stuff</t:d>
        <xsl:variable name="all-d-elements">
                <!-- how can I include all referencing documents? -->
                <xsl:copy-of select="document('')//t:d" />
        </xsl:variable>
</xsl:stylesheet>
}

I expected variable "all-d-elements" to contain <t:d>a stuff</t:d>,
<t:d>b stuff</t:d>, <t:d>c stuff</t:d>.

c.xslt is not aware of the xslt files referencing it by the include or
import actions.

Thanks for any thoughts or pointers.

Douglas Ross 
Developer, HTML UI Framework 
Kronos 
E-mail: dross(_at_)kronos(_dot_)com 
www.kronos.com 


--~------------------------------------------------------------------
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>
  • xpath:document - how to access elements from all xsl:include referencing documents, Ross, Douglas <=