1.1 --- a/examples/Common/VerySimple/Resources/structure_multivalue_template.xhtml Mon Oct 03 00:53:24 2005 +0000
1.2 +++ b/examples/Common/VerySimple/Resources/structure_multivalue_template.xhtml Mon Oct 03 00:54:19 2005 +0000
1.3 @@ -15,25 +15,24 @@
1.4
1.5 <div template:element="item">
1.6 <p>
1.7 - Some item: <input template:attribute="value" name="{template:this-attribute()}" type="text" value="{$this-value}" />
1.8 - <input name="remove={template:this-element()}" type="submit" value="Remove" />
1.9 + Some item: <input template:attribute-field="value" name="..." type="text" value="..." />
1.10 + <input template:selector-field="remove" name="..." type="submit" value="Remove" />
1.11 </p>
1.12 <p>
1.13 Item type:
1.14 - <select template:element="type" name="{template:list-attribute('type-enum', 'value')}" multiple="multiple"
1.15 + <select template:multiple-choice-list-field="type,type-enum,value" name="..." multiple="multiple"
1.16 onchange="requestUpdate(
1.17 'comments',
1.18 '{template:list-attribute('type-enum', 'value')}',
1.19 '{template:other-elements(../options)}',
1.20 '{template:child-attribute('value', template:child-element('comment', 1, template:other-elements(../options)))}',
1.21 '/structure/item/options')">
1.22 - <option template:element="type-enum" template:expr="@value-is-set" template:expr-attr="selected"
1.23 - template:value="@value" value="{@value}" />
1.24 + <option template:multiple-choice-list-value="type-enum,value,selected" />
1.25 </select>
1.26 </p>
1.27 <p template:element="options" template:id="comment-node" id="{template:this-element()}">
1.28 <span template:element="comment">Comment:
1.29 - <textarea template:attribute="value" name="{template:this-attribute()}" cols="40" rows="3">
1.30 + <textarea template:attribute-area="value" name="..." cols="40" rows="3">
1.31 <span template:value="$this-value" template:effect="replace">Some comment</span>
1.32 </textarea>
1.33 </span>
1.34 @@ -42,15 +41,15 @@
1.35 Itself containing more items:
1.36 </p>
1.37 <p template:element="subitem">
1.38 - Sub-item: <input template:attribute="subvalue" name="{template:this-attribute()}" type="text" value="{$this-value}" />
1.39 - <input name="remove2={template:this-element()}" type="submit" value="Remove" />
1.40 + Sub-item: <input template:attribute-field="subvalue" name="..." type="text" value="..." />
1.41 + <input template:selector-field="remove2" name="..." type="submit" value="Remove" />
1.42 </p>
1.43 <p>
1.44 - <input name="add2={template:this-element()}" type="submit" value="Add subitem" />
1.45 + <input template:selector-field="add2,subitem" name="..." type="submit" value="Add subitem" />
1.46 </p>
1.47 </div>
1.48 <p>
1.49 - <input name="add={template:this-element()}" type="submit" value="Add item" />
1.50 + <input template:selector-field="add,item" name="..." type="submit" value="Add item" />
1.51 </p>
1.52 <p>
1.53 <input name="update" type="submit" value="Update" />
2.1 --- a/examples/Common/VerySimple/Resources/structure_multivalue_types.xsl Mon Oct 03 00:53:24 2005 +0000
2.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2.3 @@ -1,57 +0,0 @@
2.4 -<?xml version="1.0" encoding="utf-8"?>
2.5 -<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
2.6 - xmlns:template="http://www.boddie.org.uk/ns/xmltools/template"
2.7 - version="1.0">
2.8 -
2.9 - <xsl:param name="types"/>
2.10 -
2.11 - <!-- Add or process type elements inside item elements. -->
2.12 -
2.13 - <xsl:template match="item">
2.14 - <!-- Copy the element and its contents. -->
2.15 - <xsl:copy>
2.16 - <xsl:apply-templates select="@*"/>
2.17 - <!-- Look for a type element. -->
2.18 - <xsl:call-template name="type"/>
2.19 - <xsl:apply-templates select="*[local-name() != 'type']"/>
2.20 - </xsl:copy>
2.21 - </xsl:template>
2.22 -
2.23 - <!-- Investigate type elements. -->
2.24 -
2.25 - <xsl:template name="type">
2.26 - <!-- Make the element. -->
2.27 - <type>
2.28 - <!-- Look for type element values. -->
2.29 - <xsl:call-template name="type-enum">
2.30 - <!-- Supply the existing type-enum values. -->
2.31 - <xsl:with-param name="values" select="type/type-enum/@value"/>
2.32 - </xsl:call-template>
2.33 - </type>
2.34 - </xsl:template>
2.35 -
2.36 - <!-- Add to type elements the range of acceptable values. -->
2.37 -
2.38 - <xsl:template name="type-enum">
2.39 - <xsl:param name="values"/>
2.40 - <!-- Find all values in the range and add them. -->
2.41 - <xsl:for-each select="$types/types/type-enum">
2.42 - <xsl:copy>
2.43 - <xsl:apply-templates select="@*"/>
2.44 - <!-- Mark those whose value are the same as that found on the element. -->
2.45 - <xsl:if test="$values[string() = current()/@value]">
2.46 - <xsl:attribute name="value-is-set">true</xsl:attribute>
2.47 - </xsl:if>
2.48 - </xsl:copy>
2.49 - </xsl:for-each>
2.50 - </xsl:template>
2.51 -
2.52 - <!-- Replicate unknown elements. -->
2.53 -
2.54 - <xsl:template match="@*|*|node()">
2.55 - <xsl:copy>
2.56 - <xsl:apply-templates select="@*|*|node()"/>
2.57 - </xsl:copy>
2.58 - </xsl:template>
2.59 -
2.60 -</xsl:stylesheet>
3.1 --- a/examples/Common/VerySimple/Resources/structure_template.xhtml Mon Oct 03 00:53:24 2005 +0000
3.2 +++ b/examples/Common/VerySimple/Resources/structure_template.xhtml Mon Oct 03 00:54:19 2005 +0000
3.3 @@ -13,29 +13,28 @@
3.4
3.5 <div template:element="item">
3.6 <p>
3.7 - Some item: <input template:attribute="value" name="{template:this-attribute()}" type="text" value="{$this-value}" />
3.8 - <input name="remove={template:this-element()}" type="submit" value="Remove" />
3.9 + Some item: <input template:attribute-field="value" name="..." type="text" value="..." />
3.10 + <input template:selector-field="remove" name="..." type="submit" value="Remove" />
3.11 </p>
3.12 <p>
3.13 Item type:
3.14 - <select template:element="type" name="{template:new-attribute('value')}">
3.15 - <option template:element="type-enum" template:expr="@value = ../@value" template:expr-attr="selected"
3.16 - template:value="@value" value="{@value}" />
3.17 + <select template:multiple-choice-field="type,value" name="...">
3.18 + <option template:multiple-choice-value="type-enum,value,selected" value="..." />
3.19 </select>
3.20 </p>
3.21 <p>
3.22 Itself containing more items:
3.23 </p>
3.24 <p template:element="subitem">
3.25 - Sub-item: <input template:attribute="subvalue" name="{template:this-attribute()}" type="text" value="{$this-value}" />
3.26 - <input name="remove2={template:this-element()}" type="submit" value="Remove" />
3.27 + Sub-item: <input template:attribute-field="subvalue" name="..." type="text" value="..." />
3.28 + <input template:selector-field="remove2" name="..." type="submit" value="Remove" />
3.29 </p>
3.30 <p>
3.31 - <input name="add2={template:this-element()}" type="submit" value="Add subitem" />
3.32 + <input template:selector-field="add2,subitem" name="..." type="submit" value="Add subitem" />
3.33 </p>
3.34 </div>
3.35 <p>
3.36 - <input name="add={template:this-element()}" type="submit" value="Add item" />
3.37 + <input template:selector-field="add,item" name="..." type="submit" value="Add item" />
3.38 </p>
3.39
3.40 <!-- Template text between the interesting part and the end. -->
4.1 --- a/examples/Common/VerySimple/Resources/structure_types.xml Mon Oct 03 00:53:24 2005 +0000
4.2 +++ b/examples/Common/VerySimple/Resources/structure_types.xml Mon Oct 03 00:54:19 2005 +0000
4.3 @@ -1,7 +1,7 @@
4.4 <?xml version="1.0"?>
4.5 -<types>
4.6 +<type>
4.7 <type-enum value="(Not selected)"/>
4.8 <type-enum value="Important"/>
4.9 <type-enum value="Not important"/>
4.10 <type-enum value="Personal"/>
4.11 -</types>
4.12 +</type>
5.1 --- a/examples/Common/VerySimple/Resources/structure_types.xsl Mon Oct 03 00:53:24 2005 +0000
5.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
5.3 @@ -1,48 +0,0 @@
5.4 -<?xml version="1.0" encoding="utf-8"?>
5.5 -<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
5.6 - version="1.0">
5.7 -
5.8 - <xsl:param name="types"/>
5.9 -
5.10 - <!-- Add or process type elements inside item elements. -->
5.11 -
5.12 - <xsl:template match="item">
5.13 - <!-- Copy the element and its contents. -->
5.14 - <xsl:copy>
5.15 - <xsl:apply-templates select="@*"/>
5.16 - <!-- Look for a type element. -->
5.17 - <xsl:call-template name="type"/>
5.18 - <xsl:apply-templates select="*[local-name() != 'type']"/>
5.19 - </xsl:copy>
5.20 - </xsl:template>
5.21 -
5.22 - <!-- Investigate type elements. -->
5.23 -
5.24 - <xsl:template name="type">
5.25 - <!-- Make the element. -->
5.26 - <type>
5.27 - <xsl:apply-templates select="type/@*"/>
5.28 - <xsl:call-template name="type-enum"/>
5.29 - </type>
5.30 - </xsl:template>
5.31 -
5.32 - <!-- Add to type elements the range of acceptable values. -->
5.33 -
5.34 - <xsl:template name="type-enum">
5.35 - <!-- Find all values in the range and add them. -->
5.36 - <xsl:for-each select="$types/types/type-enum">
5.37 - <xsl:copy>
5.38 - <xsl:apply-templates select="@*"/>
5.39 - </xsl:copy>
5.40 - </xsl:for-each>
5.41 - </xsl:template>
5.42 -
5.43 - <!-- Replicate unknown elements. -->
5.44 -
5.45 - <xsl:template match="@*|*|node()">
5.46 - <xsl:copy>
5.47 - <xsl:apply-templates select="@*|*|node()"/>
5.48 - </xsl:copy>
5.49 - </xsl:template>
5.50 -
5.51 -</xsl:stylesheet>