Project

Profile

Help

Bug #1859 » dbl-pipe.xsl

d d, 2013-08-06 20:23

 
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output indent="yes"/>

<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>

<xsl:template match="str/@type">
<xsl:copy>
<xsl:analyze-string select="." regex="\|((\|[^|]+\|)+)\|">
<xsl:matching-substring>
<xsl:analyze-string select="regex-group(1)" regex="\|(\w+):([^|]+)\|">
<xsl:matching-substring>
<xsl:element name="{regex-group(1)}">
<xsl:value-of select="regex-group(2)"/>
</xsl:element>
</xsl:matching-substring>
</xsl:analyze-string>
</xsl:matching-substring>
<xsl:non-matching-substring>
<xsl:value-of select="."/>
</xsl:non-matching-substring>
</xsl:analyze-string>
</xsl:copy>
</xsl:template>

</xsl:stylesheet>
(2-2/2)