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>
2.1 --- a/examples/Common/VerySimple/Resources/structure_multivalue_template.xhtml Thu Jul 21 21:52:04 2005 +0000
2.2 +++ b/examples/Common/VerySimple/Resources/structure_multivalue_template.xhtml Thu Jul 21 21:52:31 2005 +0000
2.3 @@ -23,6 +23,12 @@
2.4 template:value="@value" value="{@value}" />
2.5 </select>
2.6 </p>
2.7 + <p template:element="comment" template:id="comment-node" id="{template:this-element()}">
2.8 + Comment:
2.9 + <textarea template:attribute="value" name="{template:this-attribute()}" cols="40" rows="3">
2.10 + <span template:value="$this-value" template:effect="replace">Some comment</span>
2.11 + </textarea>
2.12 + </p>
2.13 <p>
2.14 Itself containing more items:
2.15 </p>
2.16 @@ -37,6 +43,9 @@
2.17 <p>
2.18 <input name="add={template:this-element()}" type="submit" value="Add item" />
2.19 </p>
2.20 +<p>
2.21 + <input name="update" type="submit" value="Update" />
2.22 +</p>
2.23
2.24 <!-- Template text between the interesting part and the end. -->
2.25
3.1 --- a/examples/Common/VerySimple/__init__.py Thu Jul 21 21:52:04 2005 +0000
3.2 +++ b/examples/Common/VerySimple/__init__.py Thu Jul 21 21:52:31 2005 +0000
3.3 @@ -21,7 +21,8 @@
3.4 }
3.5 transform_resources = {
3.6 #"types" : ["structure_types.xsl"]
3.7 - "types" : ["structure_multivalue_types.xsl"]
3.8 + #"types" : ["structure_multivalue_types.xsl"]
3.9 + "types" : ["structure_multivalue_types.xsl", "structure_comments.xsl"]
3.10 }
3.11 document_resources = {
3.12 "types" : "structure_types.xml"