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

Re: variable question

Subject: Re: variable question
From: Bruce D'Arcus <bdarcus@xxxxxxxxxxxxx>
Date: Wed, 10 Nov 2004 14:51:03 -0500
what is a variable question
Hi Wendell,

On Nov 10, 2004, at 1:18 PM, Wendell Piez wrote:

In XSLT 1.0 the only way to do this would be by using a stylesheet to generate your stylesheet.

Ugh.


Maybe Mike or Jeni or someone can suggest an easier way to do this in XSLT 2.0.

Maybe use a key?


I'm confused (again!). I'm basically trying to rework some of my code, in part based around Geert's suggestions, but I can't really see how to do what I'm wanting to do (which is to be able to work on content from external files). It seems, for example, that I cannot use a key on content I want to access via the doc function.

<xsl:variable name="bibrecord" select="doc(concat('bib-data/', $bibkey, '.mods'))" />
<xsl:key name="biblio" match="$bibrecord//mods:mods" use="@ID" />


Or is there some other way to do this?

<?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>


Bruce

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.