- From: Matthieu Ricaud-Dussarget <matthieu.ricaud@igs-cp.fr>
- Date: Fri, 14 Oct 2011 16:58:16 +0200
- To: xproc-dev@w3.org
Hi Romain,
Thanks for your suggest !
It almost works but I still have problem to store the load the good svg
file.
This is the code i've tested :
<p:for-each name="for-each-html-object">
<p:iteration-source select="//h:object">
<p:pipe step="generateECF" port="result"/>
</p:iteration-source>
<!--<p:output port="load-svg"/>-->
<p:load name="load-svg">
<p:with-option name="href" select="concat('PAGES_SVG_0/', @data)"/>
<!--<p:with-option name="href" select="concat('PAGES_SVG_0/',
'epub0001.svg')"/>-->
</p:load>
<p:xslt name="PDFTronSVG2epubFixedSVG">
<p:input port="stylesheet">
<p:document href="../xslt/PDFTronSVG2epubFixedSVG.xsl"/>
</p:input>
<p:input port="parameters"><p:empty/></p:input>
</p:xslt>
<p:store encoding="UTF-8" omit-xml-declaration="false" indent="true">
<p:with-option name="href" select="concat('PAGES_SVG_01/',
tokenize(document-uri(/),'/')[last()])"></p:with-option>
</p:store>
</p:for-each>
With <p:with-option name="href" select="concat('PAGES_SVG_0/',
'epub0001.svg')"/>, it works, but it's always the same document that is
processed.
But it is processed 3 times, which proof the iteration on object works
fine (there a 3 object in my document)
With <p:with-option name="href" select="concat('PAGES_SVG_0/', @data)"/>
I get an error : GRAVE: err:XC0011:Could not load PAGES_SVG_0/
It seems @data is empty at this point.
I have tried @h:data (prefix "h" binded to xhtml namespace), but I get
the same error.
The spec indicate the xpath context inside an iteration is "the sequence
of documents that will be processed by the p:for-each", that means each
document is here <object data="..."/>, so I should be able to get the
data attribute, no?
Any ideas ?
Regards,
Matthieu.
Le 13/10/2011 14:13, Romain Deltour a écrit :
>> - should I iterate the <object> elements within the XHTML doc and
>> then getting the svg document as input
>
> That's what I would do.
>
>> (...)
>> <p:input port="source" select="document(concat('PAGES_SVG_0',
>> tokenize(@data,'/')[last()] ))">
>> (...)
>
> The select expression is applied to the document connected on the
> input port. What you rather want here is to load the SVG documents
> using a dynamically computed URI, which is then connected to the
> primary input port of the XSLT. You can do that with p:load, e.g.:
>
> <p:load>
> <p:with-option name="href" select="concat('PAGES_SVG_0',
> tokenize(@data,'/')[last()])"/>
> </p:load>
>
>
> To summarize, the workflow would be:
>
> p:for-each (iterate the objects)
> p:load (load the document after having computed the URI)
> p:xslt
>
> Hope this helps,
> Romain.
>
> Le 13 oct. 11 à 13:31, Matthieu Ricaud-Dussarget a écrit :
>
>> Hi all,
>>
>> Continuing discovering xproc, I have a new problem today :
>>
>> One of the steps of my pipeline gives for result an XHTML document
>> that contains many
>> <object data="fileA.svg">, <object data="fileB.svg"> elements.
>>
>> Of course each referenced "file{?}.svg" exists in a specific
>> directory, let's call it "SVGdir".
>>
>> I'd like to iterate on those file{?}.svg and apply an XSLT
>> transformation to each one (and store the result in separate directoty).
>>
>> I don't want to iterate the "SVGdir" directly cause it can contains
>> some svg files which I don't want to transform cause they are not
>> referenced in the XHTML document.
>>
>> I think there are 2 options :
>> - filtering the directory files according to the XHTML
>> - starting from the XHTML to iterate on the good SVG files in the
>> directory
>> I thought the 2nd option is better.
>>
>> (remind : I don't want the XSLT to be applied on the XHTML document
>> itself, cause I'd like it to be independant : it takes one SVG in
>> input and get one SVG in output.)
>>
>> The spec says that <p:xslt> can have a sequence of documents as input.
>> But I don't find a way to make that work :
>> - should I give an xpath collection() for p:xslt/p:input/@select =>
>> xproc error
>> - should I iterate the <object> elements within the XHTML doc and
>> then getting the svg document as input :
>> <p:for-each name="for-each-html-object">
>> <p:iteration-source select="//h:object">
>> <p:pipe step="generateECF" port="result"/>
>> </p:iteration-source>
>> <p:xslt name="PDFTronSVG2epubFixedSVG">
>> <p:input port="source" select="document(concat('PAGES_SVG_0',
>> tokenize(@data,'/')[last()] ))">
>> <p:pipe step="for-each-html-object" port="current"/>
>> </p:input>
>> [...]
>> </p:for-each>
>> => xproc err:XD0023:Invalid XPath expression
>>
>> I will continue to investigate for other solutions, but if you have
>> any advices, they are welcome !
>>
>> Kind Regards,
>>
>> Matthieu.
>>
>> --
>> Matthieu Ricaud
>> IGS-CP
>> Service Livre numérique
>>
>>
>
>
>
--
Matthieu Ricaud
IGS-CP
Service Livre numérique
Received on Friday, 14 October 2011 14:58:53 UTC