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

xpath:document - how to access elements from all xsl:

Subject: xpath:document - how to access elements from all xsl:include referencing documents
From: "Ross, Douglas" <DRoss@xxxxxxxxxx>
Date: Fri, 21 Jan 2005 15:47:51 -0500
xpath document
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@xxxxxxxxxx
www.kronos.com

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.