Subject: Re: [xsl] variable question From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Wed, 10 Nov 2004 13:18:59 -0500 |
Cheers, Wendell
Why does my below __variable not seems to work, while if I use the same xpath expression in place of it, it does? How can I fix this to use the variable? I just want to localize in one place the configuration for where to find the data (in the below case, on the file system, in a directory called "bib-data", where each reference is in an individual file named with the value of the citation ID).
Bruce
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" xmlns:mods="http://www.loc.gov/mods/v3" xmlns:db="http://docbook.org/docbook-ng" exclude-result-prefixes="db mods">
<xsl:output method="xhtml" encoding="UTF-8" />
<xsl:variable name="bibkey" select="db:biblioref/@linkend" />
<xsl:variable name="bibrecord" select="doc(concat('bib-data/', $bibkey, '.mods'))" />
<xsl:template match="/"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Testing</title> </head> <body> <h3>Citations</h3> <xsl:for-each select="//$bibkey"> <ol> <li><xsl:value-of select="." /></li> </ol> </xsl:for-each> <h3>Titles</h3> <xsl:for-each select="//$bibkey"> <xsl:value-of select="$bibrecord//mods:title" /> </xsl:for-each> </body> </html> </xsl:template>
</xsl:stylesheet>
Source example:
<?xml version="1.0" encoding="utf-8"?>
<article xmlns="http://docbook.org/docbook-ng">
<info>
<title>Test</title>
</info>
<section>
<info>
<title>Introduction</title>
</info>
<para>Some citations: <citation><biblioref linkend="one"/><biblioref
linkend="two"/><biblioref linkend="three"/></citation>.</para>
<para>A citation with page number detail: <citation><biblioref linkend="one"
units="page" begin="23" end="24" /></citation>. A
citation <footnote><para>... in a footnote <citation><biblioref
linkend="three" begin="234"/></citation></para></footnote>.</para>
</section>
<bibliography/>
</article>
====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] variable question, Bruce D'Arcus | Thread | Re: [xsl] variable question, Bruce D'Arcus |
Re: [xsl] xsl:for-each vs. xsl:appl, Wendell Piez | Date | Re: [xsl] Re: Move (ascend) an elem, Wendell Piez |
Month |