RE: [xsl] variable question

Subject: RE: [xsl] variable question
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 11 Nov 2004 21:32:47 -0000
//biblioref selects all the biblioref elements in the document. There is
more than one. Each one has an @linkend attribute. So $bibkey evaluates to a
sequence of (more than one) attribute node. Which means you can't use it as
an argument of concat(). - An example of the stricter type rules in 2.0
catching an error that in 1.0 would have led to garbage output.

I can't correct it for you because it's not clear to me what you meant to
write.

Michael Kay
http://www.saxonica.com/  

> -----Original Message-----
> From: Bruce D'Arcus [mailto:bdarcus@xxxxxxxxxxxxx] 
> Sent: 11 November 2004 20:37
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re: [xsl] variable question
> 
> Can someone answer this question?  I'll paste the full stylesheet at 
> the bottom.
> 
> On Nov 10, 2004, at 5:56 PM, Bruce D'Arcus wrote:
> 
> > I'm getting this error though:
> >
> > 	A sequence of more than one item is not allowed as the second 
> > argument of concat()	
> > Here's how I've defined the top-level variables:
> >
> >    <xsl:variable name="bibkey" select="//db:biblioref/@linkend" />
> >    <xsl:variable name="bibrecord" select="doc(concat('bib-data/', 
> > $bibkey, '.mods'))" />
> >    <xsl:key name="biblio" match="//mods:mods" use="@ID" />
> >
> > Why am I getting that error then?
> >
> > 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 xs">
> 
>     <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:key name="biblio" match="//mods:mods" use="@ID" />
> 
>     <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="$bibrecord/key('biblio', $bibkey)">
>                 <xsl:value-of select="mods:title" />
>              </xsl:for-each>
>           </body>
>        </html>
>     </xsl:template>
> 
> </xsl:stylesheet>
> 
> Source:
> 
> <?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>

Current Thread