Problem with the document() function

Subject: Problem with the document() function
From: "Didier PH Martin" <martind@xxxxxxxxxxxxx>
Date: Sun, 13 Feb 2000 13:25:49 -0500

I am jammed with a problem in a transformation sheet that uses the
document() function.

In a template , the <xsl:apply-templates select="document(@xlink:href)"/>
tell the XSLT engine to parse and add the XML tree to the actual XML tree.
This operation seems to be OK and the included document tree is inserted in
the right element.

In the XSLT transformation sheet, all elements that are not
<xstyle:component....> elements are simply copied to the resultant output.
The <xstyle:component...> element is converted into something else. The
included document contains <xstyle:topic....> element that are to be
transformed into something else too. The problem is that the content of the
included XML document is copied but the <xstyle:topic..> elements are not
transformed. I can't find the bug and maybe I too tired or do not see the
obvious, but I do not see the faulty constructs.

Here is (below this text) the XSLT transformation sheet. As you will notice,
certain <xstyle:component...> elements trigger the processing of external
documents. The problem is that these external documents contain
<xstyle:netfolder...> or <xstyle:topic....> elements that are not processed
by the <xsl:template match="xstyle:netfolder"> or the <xsl:template
match="xstyle:topic[@xlink:type='simple']">, instead all elements of the
included document are processed by the <xsl:template match="*|@*|text()">

many thanks for your help
Didier PH Martin
Email: martind@xxxxxxxxxxxxx
Conferences: Web New York (
Book: XML Pro published by Wrox Press

		exclude-result-prefixes = "xlink xstyle"

<xsl:output method="xml" indent="yes"/>

<xsl:template match="xstyle:component">
		<!-- we embed the component's content only if
		     the xlink:show attribute is set to 'show'
		<xsl:when test="contains(@xlink:show,'embed')">
				<xsl:when test="contains(@xstyle:type,'image/svg')">
					<embed type="image/svg">
					<xsl:attribute name="src"><xsl:value-of
					<xsl:attribute name="height"><xsl:value-of
					<xsl:attribute name="width"><xsl:value-of
				<xsl:when test="contains(@xstyle:type,'text/htm')">
					<xsl:apply-templates select="document(@xlink:href)"/>
				<xsl:when test="contains(@xstyle:type,'text/xml')">
					<xsl:apply-templates select="document(@xlink:href,current())"/>
				<!-- put here other xstyle formats identified by the
		    		     xstyle:type attribute.
		     		     An xstyle:type value is the component MIME type.
		    		     For example, if the component is an SVG document, then
		    		     its MIME type is image/svg.
			<!-- We include an error message in the output document -->
			<xsl:comment>xstyle:component elements only support the xlink:show
attribute set to the "embed" value.</xsl:comment>

<xsl:template match="xstyle:netfolder">

<xsl:template match="xstyle:topic[@xlink:type='simple']">
			<xsl:attribute name="href"><xsl:value-of
			<xsl:value-of select="./@xlink:title"/>

<xsl:template match="*|@*|text()">
		<xsl:apply-templates select="*|@*|text()"/>


Didier PH Martin
Email: martind@xxxxxxxxxxxxx
Conferences: Web New York (
Book to come soon: XML Pro published by Wrox Press

 XSL-List info and archive:

Current Thread