Project

Profile

Help

XSLT 3 stylesheet using apply-templates select="descendan... » apply-templates-desc-in-var2.xsl

Martin Honnen, 2018-10-18 16:10

 
<?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"
xmlns:math="http://www.w3.org/2005/xpath-functions/math"
exclude-result-prefixes="#all"
version="3.0">
<xsl:mode streamable="yes"/>
<xsl:output method="text"/>
<xsl:template match="/">
<xsl:variable name="lines" as="xs:string*">
<xsl:apply-templates select="descendant::item"/>
</xsl:variable>
<xsl:value-of select="distinct-values($lines)" separator="&#10;"/>
</xsl:template>
<xsl:template match="item">
<xsl:apply-templates select="copy-of()" mode="line"/>
</xsl:template>
<xsl:template match="item" as="xs:string" mode="line">
<xsl:value-of select="foo, bar" separator="|"/>
</xsl:template>
</xsl:stylesheet>
(1-1/2)