Page 1 of 1

Xalan XSL redirect:write export

Posted: Wed Sep 10, 2008 2:39 pm
by DJ_Fletch
Hi guys,

I am using oXygen XML Editor 9.3 (build 2008081313).

My knowledge on XSL etc is pretty basic so hopefully I can get my question across OK.

I have an XML file which contains various sections which I want to redirect into separate XML files using an "export.xsl" using the redirect:write rule. The XML file was exported from a Structured Adobe Framemaker file.

I have set up a Xalan debugger and run the debugger and the output appears fine in the right hand panel in the XSL option in oXygen but the files do not split and save out to the folder.

Has anyone else used the Xalan "redirect:write" command that is needed for file splitting in oXygen as a alternative post-processing method? Did you come across any problems with it?

Below are copies of the XML file I want to split, its DTD and the Export XSLT.

https://www.yousendit.com/download/bVlE ... Y3BMWEE9PQ - XML file that needs to be split.

https://www.yousendit.com/download/bVlE ... RmJIRGc9PQ - DTD

https://www.yousendit.com/download/bVlE ... VFlLSkE9PQ - Export (redirect:write) XSL

Thanks in advance.

Re: Xalan XSL redirect:write export

Posted: Mon Sep 15, 2008 3:52 pm
by george
Hi,

There are a few changes you need to do in order to have that working...
Take a look at
http://xml.apache.org/xalan-j/apidocs/o ... irect.html
for documentation of the Xalan redirect extension.

The changes are like follows:
- use the correct namespace for the extensions:
xmlns:redirect="http://xml.apache.org/xalan/redirect" instead of
xmlns:redirect="org.apache.xalan.xslt.extensions.Redirect"

- add extension-element-prefixes="redirect" on the xsl:stylesheet element

- it test is supposed to be a folder then add a backslash after it, replace
<xsl:variable name="Output-folder">G:\Ops Support\_Flight Operations\Structured Notices to Crew\test</xsl:variable> with
<xsl:variable name="Output-folder">G:\Ops Support\_Flight Operations\Structured Notices to Crew\test\</xsl:variable>

- use file instead of select as the attribute inside redirect:write that specifies the file name and place the expression inside curly braces, for example:
<redirect:write select="concat($Output-folder, 'TOC.xml')">
should be changed to
<redirect:write file="{concat($Output-folder, 'TOC.xml')}">
Note that you need to change these in 4 other places where redirect:write is used.

Best Regards,
George