Re: [xsl] anyURI problem

Subject: Re: [xsl] anyURI problem
From: "Imsieke, Gerrit, le-tex" <gerrit.imsieke@xxxxxxxxx>
Date: Fri, 26 Aug 2011 10:48:29 +0200
I can only say: works for me. I tried it on the Windows 7 cmd shell (with disgust):

java -cp c:/Programme/saxon/saxon9pe.jar net.sf.saxon.Transform -xsl:test.xsl -it:test

test.xsl looks like this:

-----------------------------
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
  version="2.0"
  >

<xsl:template name="test">
<xsl:result-document href="file:///c:/temp/{encode-for-uri('[Content_Types].xml')}">
<test/>
</xsl:result-document>
</xsl:template>


</xsl:stylesheet>
-----------------------------

> dir \temp
2011-08-26  10:44    <DIR>          .
2011-08-26  10:44    <DIR>          ..
2011-08-26  10:44                45 [Content_Types].xml

>type \temp\*xml
\temp\[Content_Types].xml

<?xml version="1.0" encoding="UTF-8"?><test/>

Gerrit

On 2011-08-26 10:33, Jan Pour wrote:
Hi,

I tried both ways of how to cope with [Content_Types].xml
file in xsl:result-document href attribute:

Try using the iri-to-uri() function to turn this into a valid URI.

Saxon is fussier than some other products about insisting that URIs are
valid.

Michael Kay
Saxonica

That didnt work for me, but
href="{encode-for-uri('[Content_Types].xml')}"
did.

Or verbose
href="%5bContent_Types%5d.xml"

Gerrit

in Saxon 8 I was able to generate such file, but with versions 9.* I was not successful. With encode-for-uri() function 0-length file was generated with following error message:

java.net.URISyntaxException: Illegal character in path at index 21:
file:///C:/xslt/test/[Content_Types].xml

I tried Saxon versions: 9, 9.1 and 9.3he
Is there any other solution?

Thanks,
Jan


-- Gerrit Imsieke Geschdftsf|hrer / Managing Director le-tex publishing services GmbH Weissenfelser Str. 84, 04229 Leipzig, Germany Phone +49 341 355356 110, Fax +49 341 355356 510 gerrit.imsieke@xxxxxxxxx, http://www.le-tex.de

Registergericht / Commercial Register: Amtsgericht Leipzig
Registernummer / Registration Number: HRB 24930

Geschdftsf|hrer: Gerrit Imsieke, Svea Jelonek,
Thomas Schmidt, Dr. Reinhard Vvckler

Current Thread