1.1 --- a/examples/Common/VerySimple/Resources/structure_multivalue_types.xsl Mon Oct 03 00:53:24 2005 +0000
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,57 +0,0 @@
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 - <xsl:param name="types"/>
1.10 -
1.11 - <!-- Add or process type elements inside item elements. -->
1.12 -
1.13 - <xsl:template match="item">
1.14 - <!-- Copy the element and its contents. -->
1.15 - <xsl:copy>
1.16 - <xsl:apply-templates select="@*"/>
1.17 - <!-- Look for a type element. -->
1.18 - <xsl:call-template name="type"/>
1.19 - <xsl:apply-templates select="*[local-name() != 'type']"/>
1.20 - </xsl:copy>
1.21 - </xsl:template>
1.22 -
1.23 - <!-- Investigate type elements. -->
1.24 -
1.25 - <xsl:template name="type">
1.26 - <!-- Make the element. -->
1.27 - <type>
1.28 - <!-- Look for type element values. -->
1.29 - <xsl:call-template name="type-enum">
1.30 - <!-- Supply the existing type-enum values. -->
1.31 - <xsl:with-param name="values" select="type/type-enum/@value"/>
1.32 - </xsl:call-template>
1.33 - </type>
1.34 - </xsl:template>
1.35 -
1.36 - <!-- Add to type elements the range of acceptable values. -->
1.37 -
1.38 - <xsl:template name="type-enum">
1.39 - <xsl:param name="values"/>
1.40 - <!-- Find all values in the range and add them. -->
1.41 - <xsl:for-each select="$types/types/type-enum">
1.42 - <xsl:copy>
1.43 - <xsl:apply-templates select="@*"/>
1.44 - <!-- Mark those whose value are the same as that found on the element. -->
1.45 - <xsl:if test="$values[string() = current()/@value]">
1.46 - <xsl:attribute name="value-is-set">true</xsl:attribute>
1.47 - </xsl:if>
1.48 - </xsl:copy>
1.49 - </xsl:for-each>
1.50 - </xsl:template>
1.51 -
1.52 - <!-- Replicate unknown elements. -->
1.53 -
1.54 - <xsl:template match="@*|*|node()">
1.55 - <xsl:copy>
1.56 - <xsl:apply-templates select="@*|*|node()"/>
1.57 - </xsl:copy>
1.58 - </xsl:template>
1.59 -
1.60 -</xsl:stylesheet>