- From: Geert Josten <geert.josten@daidalos.nl>
- Date: Thu, 13 Oct 2011 14:09:27 +0200
- To: Matthieu Ricaud-Dussarget <matthieu.ricaud@igs-cp.fr>, "XProc Dev (xproc-dev@w3.org)" <xproc-dev@w3.org>
Hi Matthieu, I did something similar a few times. I just used a p:viewport to do the trick. The p:viewport takes the XHTML with the objects as input. You give the viewport a match on object. That will cause the viewport to return the object elements as documents one by one. You can pass that straight-forward into p:xslt. Put a p:store behind p:xslt to store the output of the XSLT. Add an empty identity after p:store to make sure p:viewport has output. <p:viewport match="object"> <p:xslt .../> <p:store .../> <p:identity... /> </p:viewport> Note that this will remove the objects from the XHTML stream. You will need to reroute input here or there if you want to do more with them, or with the XHTML in whole.. Kind regards, Geert -----Oorspronkelijk bericht----- Van: xproc-dev-request@w3.org [mailto:xproc-dev-request@w3.org] Namens Matthieu Ricaud-Dussarget Verzonden: donderdag 13 oktober 2011 13:32 Aan: XProc Dev Onderwerp: sequence of filtered documents as input of p:xslt 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:10:07 UTC