xsl-list
[Top] [All Lists]

doc() concat expression and whitespace error

2004-11-15 18:16:19
I'm working on pulling in -- using the doc() function -- documents from the eXist XML DB via it's http interface.

Here's my template:

  <xsl:template match="db:bibliography" mode="create-bibcollection">
    <bibliography>
      <modsCollection xmlns="http://www.loc.gov/mods/v3";>
        <xsl:for-each select="distinct-values(key('citekey', 'all'))">
  <!--+ ================================================
    | bibrecord variable identifies where to locate the bib records; in
    | this case, we access them via http from an eXist XML DB
    +-->
          <xsl:variable name="bibrecord"
select='doc(concat("http://localhost:8080/exist/servlet/db/mods? _query=", "/mods:modsCollection/mods:mods[(_at_)ID='", ., "']"))'/>
          <xsl:copy-of select="$bibrecord" />
        </xsl:for-each>
      </modsCollection>
    </bibliography>
  </xsl:template>

However, when I run it from Saxon, I get this error:

          Error reported by XML parser: Whitespace required before attributes.

So, I decided to try to access a document via a web browser. I got an error until I added the namespace declaration in the query. So, this works from the browser:

http://localhost:8080/exist/servlet/db/biblio? _query=declare%20namespace%20mods=%22http://www.loc.gov/mods/v3%22;/ mods:modsCollection/mods:mods[(_at_)ID='Tilly2000a']

.... but this does not from Saxon:

<xsl:variable name="bibrecord"
select='doc(concat("http://localhost:8080/exist/servlet/db/biblio? _query=declare%20namespace%20mods=%22http://www.loc.gov/mods/v3%22;";, "/mods:modsCollection/mods:mods[(_at_)ID='", ., "']"))'/>

I know in theory it should work, since I got the suggestion from the author of eXist; am just not sure where the problem is. Is there something wrong with my variable select expression (which is what the error is being reported about) from the XSLT/Saxon side?

Bruce


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--