RE: [xsl] doc() concat expression and whitespace error

Subject: RE: [xsl] doc() concat expression and whitespace error
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 16 Nov 2004 02:40:27 -0000
> select='doc(concat("http://localhost:8080/exist/servlet/db/mods? 
> _query=", "/mods:modsCollection/mods:mods[@ID='", ., "']"))'/>
> 
> However, when I run it from Saxon, I get this error:
> 
> 	  Error reported by XML parser: Whitespace required 
> before attributes.

When Saxon prefixes a message with "Error reported by XML parser" it means
that the error is at the XML level rather than the XSLT level - the
stylesheet is not well-formed XML. 

Your attribute starts with {select='} so it ends with the next {'} which is
the one in {@ID='}, which is not followed by a space. 

If you need to use ' within an attribute delimited by ', you can write it as
&apos;, thus:

select='doc(concat("http://localhost:8080/exist/servlet/db/mods?_query=";,
"/mods:modsCollection/mods:mods[@ID=&apos;", ., "&apos;]"))'/>

But since the apostrophe is actually a character appearing in a URI, it
might be even better to escape it as %H27. Square brackets in a URI should
also probably be %HH-escaped.

Michael Kay

Current Thread