RE: Multiple XSLT transformations with intermediate files

Hi Patrick,

Did you check my edited answer. The second approach should at least get
you going..

Kind regards,
Geert

> -----Oorspronkelijk bericht-----
> Van: Patrick Gundlach [mailto:patrick@gundla.ch]
> Verzonden: donderdag 17 mei 2012 15:58
> Aan: xproc-dev@w3.org
> Onderwerp: Multiple XSLT transformations with intermediate files
>
> Hello all,
>
> I am a newbee and not sure if this is the right place to ask.
>
> ( This is also a duplicate of
> http://stackoverflow.com/questions/10636613/xproc-multiple-xslt-
> tranformation-with-intermediate-files - but I think I get better answers
here )
>
> Why do I get the errors mentioned below? What is the right way to
connect the
> pipelines?
>
>
> I need to do several XSLT transformations with intermediate XML files.
>
>     first.xml ------------>   intermediate.xml ------------> final.xml
>                first.xsl                         final.xsl
>
> I'd like to create an XProc pipleline. I have tried to write the
following code, but
> this gives me an error:
>
>
>     SCHWERWIEGEND: runxslt.xpl:26:44:err:XD0011:Could not read:
> intermediate.xml
>     17.05.2012 15:15:35 com.xmlcalabash.drivers.Main error
>     SCHWERWIEGEND: It is a dynamic error if the resource referenced by a
> p:document element does not exist, cannot be accessed, or is not a
well-formed
> XML document.
>     17.05.2012 15:15:35 com.xmlcalabash.drivers.Main error
>     SCHWERWIEGEND: Underlying exception:
> net.sf.saxon.s9api.SaxonApiException: I/O error reported by XML parser
> processing file:/<somepath>/intermediate.xml:
>     /<somepath>/intermediate.xml (No such file or directory)
>
> (where SCHWERWIEGEND means something like FATAL) So obviously the file
> `intermediate.xml` has not been written.
>
> This is the `xpl`-document that I have used:
>
>     <?xml version="1.0" encoding="UTF-8"?>
>     <p:declare-step xmlns:p="http://www.w3.org/ns/xproc"
>       xmlns:c="http://www.w3.org/ns/xproc-step" version="1.0">
>
>       <p:input port="source">
>         <p:document href="first.xml"/>
>       </p:input>
>
>       <p:output port="result" sequence="true">
>         <p:empty/>
>       </p:output>
>
>       <p:xslt name="first-to-intermediate">
>         <p:input port="stylesheet">
>           <p:document href="first.xsl"/>
>         </p:input>
>         <p:input port="parameters">
>           <p:empty/>
>         </p:input>
>       </p:xslt>
>
>       <p:store href="intermediate.xml" />
>
>       <p:xslt>
>         <p:input port="source">
>           <p:document href="intermediate.xml"/>
>         </p:input>
>         <p:input port="stylesheet">
>           <p:document href="final.xsl"/>
>         </p:input>
>         <p:input port="parameters">
>           <p:empty/>
>         </p:input>
>       </p:xslt>
>
>       <p:store href="final.xml"/>
>
>     </p:declare-step>
>
> Just for the sake of completeness: these are the transformation files:
>
> source.xml:
>
>     <root>
>       <element name="A" />
>     </root>
>
> first.xsl:
>
>     <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>       version="2.0">
>       <xsl:output indent="yes"/>
>
>       <xsl:template match="root">
>         <root>
>           <xsl:apply-templates/>
>         </root>
>       </xsl:template>
>       <xsl:template match="element">
>         <intermediate name="A" />
>       </xsl:template>
>
>     </xsl:stylesheet>
>
> final.xsl:
>
>     <?xml version="1.0" encoding="UTF-8"?>
>     <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>       version="2.0">
>       <xsl:output indent="yes"/>
>
>       <xsl:template match="root">
>         <root>
>           <xsl:apply-templates/>
>         </root>
>       </xsl:template>
>       <xsl:template match="intermediate">
>         <final name="A" />
>       </xsl:template>
>
>     </xsl:stylesheet>
>
>
>
> Thanks
>
> Patrick
>
>

Received on Saturday, 19 May 2012 10:19:21 UTC