- From: Alex Miłowski <alex@milowski.com>
- Date: Wed, 16 Mar 2016 14:00:51 -0700
- To: XProc WG <public-xml-processing-model-wg@w3.org>
I assert that this use of viewport: $doc → replace("//section") { $matched → filter() → $replacement } ≫ $result can be done with this: $doc//section ! filter() ≫ $replacements xslt([source=$doc,collection=$replacements,stylesheet="stitch.xsl"]) ≫ $result assuming we can bind the default collection and 'stitch.xsl' is: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs" version="2.0"> <xsl:variable name="codes" as="xs:string*"> <xsl:for-each select="//section"> <xsl:sequence select="generate-id(.)"/> </xsl:for-each> </xsl:variable> <xsl:template match="//section"> <xsl:copy-of select="subsequence(collection(),index-of($codes,generate-id(.)),1)"/> </xsl:template> <xsl:template match="node()|@*"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> <xsl:template match="node()" mode="codes"> <xsl:value-of select="generate-id(.)"/> </xsl:template> </xsl:stylesheet> -- --Alex Miłowski "The excellence of grammar as a guide is proportional to the paucity of the inflexions, i.e. to the degree of analysis effected by the language considered." Bertrand Russell in a footnote of Principles of Mathematics
Received on Wednesday, 16 March 2016 21:01:19 UTC