RE: [xsl] Nordic Characters in variables

Subject: RE: [xsl] Nordic Characters in variables
From: <trond.huso@xxxxxx>
Date: Mon, 16 Jan 2012 11:52:33 +0000
-----Original Message-----
From: Michael Kay [mailto:mike@xxxxxxxxxxxx]
Sent: 16. januar 2012 11:33
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] Nordic Characters in variables

On 16/01/2012 10:07, trond.huso@xxxxxx wrote:
> Sorry about this:
> What I am doing is this:
> <xsl:variable name="filename">
>              <xsl:value-of select="//filename"/>
>          </xsl:variable>
That's a long-winded and expensive way of doing

True, so I have shortened it, but it also makes it easier to see what you are
doing - and especially if there are others looking at the lines.

<xsl:variable name="filename" select="//filename"/>
>
> Where the //filename points to:
> <filename>RES_FF_20110924_084810</filename>
>
> Error I am getting is:
> 2012-01-16 09:55:57: An Exception has occured:
> 'file:///j:/NTB-Normalizer/xml/Travresultater/RES_X_20101015_095157.xm
> l' is not a valid windows path or URI. at xsl:variable
> J:\NTB-Normalizer\xslt\Travdata\Travdata.xsl
I suspect you are getting the error when you use the variable, not when you
declare it. I imagine you are using the variable as an argument to the doc()
or document() function. The argument to this is expected to be a valid URI,
and non-ASCII characters are not valid in URIs: try calling
encode-for-uri() first:

http://www.w3.org/TR/xpath-functions/#func-encode-for-uri

Yes, this did the trick. Thanks for pointing this out for me!

Trond Husx

Current Thread