- From: Norman Walsh <ndw@nwalsh.com>
- Date: Sun, 21 Dec 2008 15:06:32 -0500
- To: XProc Dev <xproc-dev@w3.org>
- Message-ID: <m2ej01cmyf.fsf@nwalsh.com>
"Dave Pawson" <dave.pawson@gmail.com> writes: > I'm looking for an example of p:for-each > > Scenario. > > The current directory has many *.xpl files > I want to return the p:declare-step/@name value > > Starting with > <p:for-each > name? = NCName> > ((p:iteration-source? & > (p:output | > p:log)*), > subpipeline) > </p:for-each> > "When a pipeline needs to process a sequence of documents " > (Does this mean a sequence of documents in a directory???? perhaps > not, but since it's undefined in > the rec.... that's how I want to interpret it) A sequence of documents is...a sequence of zero or more documents. For example, if you use select to grab all the chapters of a book, that creates a sequence of chapter documents. > I want to select a p:iteration source (the source over which I want to iterate) > > I try p:document and hit XD0011 when I try *.xpl in the @href attribute. > > Anyone got a practical example of using p:for-each please? > I couldn't find anything in the test suite either. > > Am I looking for a single file with many 'documents' within it? What you probably want is something like this: <p:directory-list path="." include-filter=".*\.xpl"/> <p:make-absolute-uris match="c:file/@name"> <p:with-option name="base-uri" select="/c:directory/@xml:base"/> </p:make-absolute-uris> <p:for-each> <p:iteration-source select="//c:file"/> <p:load> <p:with-option name="href" select="/c:file/@name"/> </p:load> </p:for-each> The result of that for-each is a sequence of documents (the pipelines that were found by the directory-list step). You can then look at each of their @name attributes if that's what you're after. Be seeing you, norm -- Norman Walsh <ndw@nwalsh.com> | Being forced to write comments actually http://nwalsh.com/ | improves code, because it is easier to | fix a crock than to explain it.--G. | Steele
Received on Sunday, 21 December 2008 20:07:12 UTC