Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 31st, 2011, 01:46 PM
Friend of Wrox
 
Join Date: May 2004
Posts: 109
Thanks: 18
Thanked 0 Times in 0 Posts
Default result-document and filenaming

Hi,

Using Saxon 9, Windows 7 and Solaris.

My XSLT script needs to generate a bunch of XML files with various filenames. For one reason or another some of these filename need to include the '#' character.

<xsl:result-document> is throwing an exception 'Invalid URI syntax: URI has a fragment component'.

I've looked at the various attributes for result-document, but I don't see any that will allow me to name a file using the '#' character.

Is this even possible?

Thanks,
__________________
------------------------
Keep Moving Forward

GnuPG Key fingerprint = 1AD4 726D E359 A31D 05BF ACE5 CA93 7AD5 D8E3 A876

Michael Hare
 
Old October 31st, 2011, 02:07 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

xsl:result-document expects a URI, and as you say, # is not valid (or has special meaning) in a URI. You could try escaping it as %23, but somehow I suspect you would end up with a filename containing %23 rather than one containing #.

In Saxon you can register an OutputURIResolver which is called to process the URI supplied to xsl:result-document. For example you could subclass the StandardOutputResolver, overriding its makeOutputFile() method to unescape %23 (and optionally other escape sequences) found in the URI.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
result-document: capital letter or not CHRD XSLT 2 March 9th, 2010 06:53 PM
Unknown XSLT element:result-document nisargmca XSLT 2 January 6th, 2010 07:34 AM
grouping and result-document help mrame XSLT 2 October 21st, 2008 11:01 PM
SAXON - result-document bonekrusher XSLT 3 May 7th, 2007 08:27 AM
xsl:result-document instruction bonekrusher XSLT 3 April 12th, 2007 06:01 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.