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

> 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?

These documents should be readable on the "secondary" output port of the p:xslt step. You can iterate over them with a p:for-each and use a p:store inside to write them.
Note that they will have a base URI corresponding to the @href you set in the XSLT.

Romain.

On 16 déc. 2012, at 03:01, Mark Wilson <mark@knihtisk.org> wrote:

> 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:48:36 UTC