1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/examples/Common/VerySimple/Resources/structure_comments.xsl Thu Jul 21 21:52:31 2005 +0000
1.3 @@ -0,0 +1,40 @@
1.4 +<?xml version="1.0" encoding="utf-8"?>
1.5 +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
1.6 + xmlns:template="http://www.boddie.org.uk/ns/xmltools/template"
1.7 + version="1.0">
1.8 +
1.9 + <!-- Add or process comment elements inside item elements. -->
1.10 + <!-- This transformation must happen after type elements have been populated. -->
1.11 +
1.12 + <xsl:template match="item">
1.13 + <!-- Copy the element and its contents. -->
1.14 + <xsl:copy>
1.15 + <xsl:apply-templates select="@*"/>
1.16 + <!-- Only for certain element types... -->
1.17 + <xsl:if test="type/type-enum[@value='Personal' and @value-is-set]">
1.18 + <!-- Ensure a comment element. -->
1.19 + <xsl:call-template name="comment"/>
1.20 + </xsl:if>
1.21 + <xsl:apply-templates select="*[local-name() != 'comment']"/>
1.22 + </xsl:copy>
1.23 + </xsl:template>
1.24 +
1.25 + <!-- Investigate comment elements. -->
1.26 +
1.27 + <xsl:template name="comment">
1.28 + <!-- Make the element. -->
1.29 + <comment>
1.30 + <!-- Look for comment text. -->
1.31 + <xsl:apply-templates select="comment/@*"/>
1.32 + </comment>
1.33 + </xsl:template>
1.34 +
1.35 + <!-- Replicate unknown elements. -->
1.36 +
1.37 + <xsl:template match="@*|*|node()">
1.38 + <xsl:copy>
1.39 + <xsl:apply-templates select="@*|*|node()"/>
1.40 + </xsl:copy>
1.41 + </xsl:template>
1.42 +
1.43 +</xsl:stylesheet>