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