- From: Romain Deltour <rdeltour@gmail.com>
- Date: Thu, 13 Oct 2011 14:13:25 +0200
- To: Matthieu Ricaud-Dussarget <matthieu.ricaud@igs-cp.fr>
- Cc: XProc Dev <xproc-dev@w3.org>
> - 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 > >
Received on Thursday, 13 October 2011 12:14:00 UTC