W3C home > Mailing lists > Public > xproc-dev@w3.org > December 2012

How to output a sequence of result documents named inside the XSLT styl;esheet?

From: Mark Wilson <mark@knihtisk.org>
Date: Sat, 15 Dec 2012 19:01:58 -0700
Message-ID: <50CD2B96.6040709@knihtisk.org>
To: xproc-dev@w3.org
I have the following XPL script, but do not know how to store the xml 
documents named inside the XSLT stylesheet
13CatalogsByName. Both it and the script are below:

Any help appreciated, as I will be reusing this pattern.
Thanks,
Mark

<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" name="myPipeline" 
version="1.0">
<!-- This is the xml input -->
<p:input port="source">
<p:document href="../all-data-1975.xml"/>
</p:input>
<!-- Send the result of applying the stylesheets here -->
<p:output port="result" sequence="true">
<!-- <p:pipe step="step1" port="result"/> -->
</p:output>

<!-- Apply the first stylesheet -->
<p:xslt name="select-catalogs">
<p:input port="source"/>
<p:input port="stylesheet">
<p:document href="10CatalogSelect.xsl"/>
</p:input>
<p:input port="parameters" >
<p:empty/>
</p:input>
</p:xslt>

<!-- Apply the second stylesheet -->
<p:xslt name="sort-catalogs">
<p:input port="source"/>
<p:input port="stylesheet">
<p:document href="11CatalogsSort.xsl"/>
</p:input>
<p:input port="parameters" >
<p:empty/>
</p:input>
</p:xslt>

<!-- Apply the third stylesheet -->
<p:xslt name="dedupe-catalogs">
<p:input port="source"/>
<p:input port="stylesheet">
<p:document href="12CatalogDedupe.xsl"/>
</p:input>
<p:input port="parameters" >
<p:empty/>
</p:input>
</p:xslt>

<!--

<p:store href="../work/400.xml" name="step1"/>
This works and outputs the result of the first three steps

However,
The fourth stylesheet outputs a series of xsl:result-document
<xsl:result-document 
href="{concat('..\work\',replace(replace(replace(current-grouping-key(),'Č', 
'C'),'á', 'a'), 'ý', 'y'))}.xml">
How do I store each of these documents?
-->

<!-- Apply the fourth stylesheet -->
<p:xslt name="xml-catalogs">
<p:input port="source"/>
<p:input port="stylesheet">
<p:document href="13CatalogsByName.xsl"/>
</p:input>
<p:input port="parameters" >
<p:empty/>
</p:input>
</p:xslt>
</p:declare-step>

XSLT Stylesheet
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
version="2.0">
<xsl:output method="xml"/>

<xsl:template match="List">
<xsl:for-each-group select="Item" group-by="CatalogName">
<xsl:result-document 
href="{concat('..\work\',replace(replace(replace(current-grouping-key(),'Č', 
'C'),'á', 'a'), 'ý', 'y'))}.xml">
<List>
<xsl:for-each select="current-group()">
<xsl:copy-of select="." copy-namespaces="no"/>
</xsl:for-each>
</List>
</xsl:result-document>
</xsl:for-each-group>
</xsl:template>

</xsl:stylesheet>

-- 
Mark Wilson
Knihtisk Publishing
Received on Tuesday, 18 December 2012 07:21:42 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 18 December 2012 07:21:43 GMT