In using the document( ) function, I am trying to reference files in a
common directory. I am basing my XSL on Doug Tidwell's example in Ch 7,
pp. 148-152 of his XSLT, O'Reilly book
(http://examples.oreilly.com/xslt/). Tidwell's example works on my
machine where I run transformations using SAXON 6.5.2. My attempt does
not work when I use that example to do something similar files that use
simplified Dublin Core and RDF namespaces. Is my referencing of the
namespaces a problem or is something else in my XSL to blame?
Here are samples of my XML and XSL files. Note: I have successfully run
transformations against d923.xml as an individual file with a different
stylesheet. Doing several files at once (listed in widg-main.xml) is the
problem.
========================
widg-main.xml
========================
<?xml version="1.0" encoding="ISO-8859-1"?>
<subject id="s0008" topic-area="Widgets">
<title>Maintenance & Repair</title>
<resource filename="d923.xml"/>
<resource filename="w034asm.xml"/>
<resource filename="w035farm.xml"/>
</subject>
========================
widget.xsl
========================
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<xsl:output method="html" indent="no"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<html>
<head>
<title><xsl:value-of select="/subject/@topic-area"/>
<xsl:text> </xsl:text> <xsl:value-of select="/subject/title"/></title>
<link rel="stylesheet" type="text/css" href="midd.css"
title="Default"/>
</head>
<body>
<xsl:for-each select="/subject/resource">
<xsl:apply-templates
select="document(@filename)/rdf:Description"/>
<h1><xsl:value-of select="@filename"/></h1>
<hr size="2" width="95%" align="left" style="color:
#006699;"/>
</xsl:for-each>
</body>
</html>
</xsl:template>
<xsl:template match="/rdf:Description">
<h4><xsl:text>You are here in rdf:Description.</xsl:text></h4>
<span class="title">Title: <xsl:value-of select="."/></span>
</xsl:template>
.
.
etc.
===============================================
d923.xml (one of the files referenced in widget-main.xml
===============================================
<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
<!DOCTYPE rdf:RDF SYSTEM "dcmes-xml-dtd.dtd">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<rdf:Description id="d923" about="http://www.librarydataserver.com/"
gourl="http://www.ourlibrary.org/somedirectory/wanna-go-there.asp"
free="No" home="No">
<dc:title>Some Database Title</dc:title>
<dc:publisher>Some Publisher</dc:publisher>
<dc:dateCopyrighted>2002</dc:dateCopyrighted>
<dc:language>en</dc:language>
<dc:date>2002-12-09</dc:date>
<dc:type>Collection</dc:type>
<dc:subject>Widgets -- Maintenance and repair</dc:subject>
<dc:identifier
id="http://www.ourlibrary.org/somedirectory/wanna-go-there.asp">http://www.librarydataserver.com/</dc:identifier>
<dc:description>Repair information on widgets. Includes design plans
of widgets.</dc:description>
<dc:abstract>Comprehensive repair info on widgets made from 1982 to
the present.</dc:abstract>
<dc:rights>Licensed for in-library use at all Library locations. No
remote access permitted.</dc:rights>
</rdf:Description>
</rdf:RDF>
========================
I run
saxon -o widget.htm widg-main.xml widget.xsl
The initial template runs and the <xsl:for-each> gives me the proper
filename of each file in widg-main.xml. But the
<xsl:apply-templates select="document(@filename)/rdf:Description"/>
seems to be the place where the transformation ends.
Seasons greetings!
Bret
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list