dmarston 01/08/13 08:22:01
Added: test/tests/conf/numbering iddata.dtd numbering86.xml
numbering86.xsl numbering87.xml numbering87.xsl
numbering88.xml numbering88.xsl numbering89.xml
numbering89.xsl numbering90.xml numbering90.xsl
numbering91.xml numbering91.xsl
Log:
New cases involving namespaces, position, id, key
Revision Changes Path
1.1 xml-xalan/test/tests/conf/numbering/iddata.dtd
Index: iddata.dtd
===================================================================
<?xml version="1.0" encoding="UTF-8"?>
<!ELEMENT iddata (a*)>
<!ELEMENT el EMPTY>
<!ATTLIST el id ID #REQUIRED>
1.1 xml-xalan/test/tests/conf/numbering/numbering86.xml
Index: numbering86.xml
===================================================================
<?xml version="1.0"?>
<z:doc xmlns:z="z.test.com">
<z:chapter>
<z:note>aaa</z:note>
<z:note>bbb</z:note>
<z:note>ccc</z:note>
</z:chapter>
<z:chapter>
<z:note>ddd</z:note>
<z:note>eee</z:note>
<z:note>fff</z:note>
</z:chapter>
</z:doc>
1.1 xml-xalan/test/tests/conf/numbering/numbering86.xsl
Index: numbering86.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:z="z.test.com">
<!-- CaseName: numbering86 -->
<!-- Creator: David Marston -->
<!-- Purpose: Namespaced elements should work just like non-namespaced ones. -->
<!-- SpecCitation: Rec="XSLT" Version="1.0" type="OASISptr1"
place="id(number)/ulist[2]/item[1]/p[1]/text()[5]" -->
<!-- SpecCitation: Rec="XSLT" Version="1.0" type="OASISptr1"
place="id(number)/ulist[1]/item[2]/p[1]/text()[3]" -->
<!-- SpecCitation: Rec="XSLT" Version="1.0" type="OASISptr1"
place="id(number)/ulist[1]/item[3]/p[1]/text()[1]" -->
<!-- SpecCitation: Rec="XSLT" Version="1.0" type="OASISptr1"
place="id(convert)/p[2]/text()[3]" -->
<!-- Scenario: operation="standard-XML" -->
<xsl:template match="z:doc">
<out>
<xsl:apply-templates/>
</out>
</xsl:template>
<xsl:template match="z:note">
<xsl:element name="znote">
<xsl:attribute name="number">
<xsl:number level="single" from="z:chapter"/>
</xsl:attribute>
<xsl:value-of select="."/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
1.1 xml-xalan/test/tests/conf/numbering/numbering87.xml
Index: numbering87.xml
===================================================================
<?xml version="1.0"?>
<z:doc xmlns:z="z.test.com">
<z:chapter>
<note>aaa</note>
<z:note>bbb</z:note>
<z:note>ccc</z:note>
</z:chapter>
<z:chapter>
<z:note>ddd</z:note>
<note>eee</note>
<z:note>fff</z:note>
</z:chapter>
<z:chapter>
<z:note>ggg</z:note>
<z:note>hhh</z:note>
<note>iii</note>
</z:chapter>
<z:chapter>
<z:note>jjj</z:note>
<z:note>kkk</z:note>
<note>lll</note>
</z:chapter>
</z:doc>
1.1 xml-xalan/test/tests/conf/numbering/numbering87.xsl
Index: numbering87.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:z="z.test.com">
<!-- CaseName: numbering87 -->
<!-- Creator: David Marston -->
<!-- Purpose: Number the namespaced elements when mixed with non-namespaced ones.
-->
<!-- SpecCitation: Rec="XSLT" Version="1.0" type="OASISptr1"
place="id(number)/ulist[2]/item[1]/p[1]/text()[5]" -->
<!-- SpecCitation: Rec="XSLT" Version="1.0" type="OASISptr1"
place="id(number)/ulist[2]/item[3]/p[1]/text()[6]" -->
<!-- SpecCitation: Rec="XSLT" Version="1.0" type="OASISptr1"
place="id(number)/ulist[1]/item[2]/p[1]/text()[3]" -->
<!-- SpecCitation: Rec="XSLT" Version="1.0" type="OASISptr1"
place="id(number)/ulist[1]/item[3]/p[1]/text()[1]" -->
<!-- SpecCitation: Rec="XSLT" Version="1.0" type="OASISptr1"
place="id(convert)/p[2]/text()[3]" -->
<!-- Scenario: operation="standard-XML" -->
<xsl:template match="z:doc">
<out>
<xsl:apply-templates/>
</out>
</xsl:template>
<xsl:template match="z:note">
<xsl:element name="znote">
<xsl:attribute name="number">
<xsl:number level="any" from="z:doc"/>
</xsl:attribute>
<xsl:value-of select="."/>
</xsl:element>
</xsl:template>
<xsl:template match="note">
<xsl:element name="chapter-note">
<xsl:attribute name="number">
<xsl:number level="single" from="z:chapter"/>
</xsl:attribute>
<xsl:value-of select="."/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
1.1 xml-xalan/test/tests/conf/numbering/numbering88.xml
Index: numbering88.xml
===================================================================
<?xml version="1.0"?>
<doc>
<chapter>
<note>aaa</note>
</chapter>
<chapter>
<note>zzz</note>
</chapter>
</doc>
1.1 xml-xalan/test/tests/conf/numbering/numbering88.xsl
Index: numbering88.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<!-- CaseName: numbering88 -->
<!-- Creator: David Marston -->
<!-- Purpose: Show discrepancies between number and position. -->
<!-- SpecCitation: Rec="XSLT" Version="1.0" type="OASISptr1"
place="id(number)/ulist[2]/item[1]/p[1]/text()[5]" -->
<!-- SpecCitation: Rec="XSLT" Version="1.0" type="OASISptr1"
place="id(number)/ulist[2]/item[3]/p[1]/text()[6]" -->
<!-- SpecCitation: Rec="XSLT" Version="1.0" type="OASISptr1"
place="id(number)/ulist[1]/item[2]/p[1]/text()[3]" -->
<!-- SpecCitation: Rec="XSLT" Version="1.0" type="OASISptr1"
place="id(number)/ulist[1]/item[3]/p[1]/text()[1]" -->
<!-- SpecCitation: Rec="XSLT" Version="1.0" type="OASISptr1"
place="id(convert)/p[2]/text()[3]" -->
<!-- Scenario: operation="standard-XML" -->
<!-- Elaboration: While xsl:number always shows the number of the chapter among
all chapters,
position() in the outer case is the position of the chapter among all
children of doc,
position() in the inner case is the position of the chapter within the
select="." set
that contains just one element. -->
<xsl:template match="doc">
<out>
<xsl:apply-templates/>
</out>
</xsl:template>
<xsl:template match="chapter">
<xsl:element name="chap">
<xsl:attribute name="number">
<xsl:number/>
</xsl:attribute>
<xsl:attribute name="position">
<xsl:value-of select="position()"/>
</xsl:attribute>
<xsl:value-of select="note[1]"/>
<xsl:apply-templates select="." mode="repeat"/>
</xsl:element>
</xsl:template>
<xsl:template match="chapter" mode="repeat">
<xsl:element name="sel">
<xsl:attribute name="number">
<xsl:number/>
</xsl:attribute>
<xsl:attribute name="position">
<xsl:value-of select="position()"/>
</xsl:attribute>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
1.1 xml-xalan/test/tests/conf/numbering/numbering89.xml
Index: numbering89.xml
===================================================================
<?xml version="1.0"?>
<doc>
<chapter>
<note>aaa</note>
</chapter>
<chapter>
<note>zzz</note>
</chapter>
</doc>
1.1 xml-xalan/test/tests/conf/numbering/numbering89.xsl
Index: numbering89.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<!-- CaseName: numbering89 -->
<!-- Creator: David Marston -->
<!-- Purpose: Show discrepancies between number and position. -->
<!-- SpecCitation: Rec="XSLT" Version="1.0" type="OASISptr1"
place="id(number)/ulist[2]/item[1]/p[1]/text()[5]" -->
<!-- SpecCitation: Rec="XSLT" Version="1.0" type="OASISptr1"
place="id(number)/ulist[2]/item[3]/p[1]/text()[6]" -->
<!-- SpecCitation: Rec="XSLT" Version="1.0" type="OASISptr1"
place="id(number)/ulist[1]/item[2]/p[1]/text()[3]" -->
<!-- SpecCitation: Rec="XSLT" Version="1.0" type="OASISptr1"
place="id(number)/ulist[1]/item[3]/p[1]/text()[1]" -->
<!-- SpecCitation: Rec="XSLT" Version="1.0" type="OASISptr1"
place="id(convert)/p[2]/text()[3]" -->
<!-- Scenario: operation="standard-XML" -->
<!-- Elaboration: While xsl:number always shows the number of the chapter among
all chapters,
position() in the outer case is the position of the chapter among all
children of doc,
position() in the inner case (repeat mode) is the position of the
chapter/text within the select set
that contains the chapter and all its siblings. -->
<xsl:template match="doc">
<out>
<xsl:apply-templates/>
</out>
</xsl:template>
<xsl:template match="chapter">
<xsl:element name="chap">
<xsl:attribute name="number">
<xsl:number/>
</xsl:attribute>
<xsl:attribute name="position">
<xsl:value-of select="position()"/>
</xsl:attribute>
<xsl:value-of select="note[1]"/>
<xsl:apply-templates select="../node()" mode="repeat"/>
</xsl:element>
</xsl:template>
<xsl:template match="chapter" mode="repeat">
<xsl:element name="sel">
<xsl:attribute name="number">
<xsl:number/>
</xsl:attribute>
<xsl:attribute name="position">
<xsl:value-of select="position()"/>
</xsl:attribute>
</xsl:element>
</xsl:template>
<xsl:template match="text()" mode="repeat">
<xsl:text> </xsl:text>
<xsl:element name="text">
<xsl:attribute name="number">
<xsl:number/>
</xsl:attribute>
<xsl:attribute name="position">
<xsl:value-of select="position()"/>
</xsl:attribute>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
1.1 xml-xalan/test/tests/conf/numbering/numbering90.xml
Index: numbering90.xml
===================================================================
<?xml version="1.0"?>
<doc>
<chapter>
<note flag="yes">aaa</note>
<note flag="no">bbb</note>
<note flag="no">ccc</note>
<note flag="yes">ddd</note>
<note flag="yes">eee</note>
</chapter>
<note flag="no">fff</note>
<note flag="yes">ggg</note>
<note flag="yes">hhh</note>
<chapter>
<note flag="yes">iii</note>
<note flag="yes">jjj</note>
<note flag="no">kkk</note>
<note flag="yes">lll</note>
<note flag="no">mmm</note>
</chapter>
</doc>
1.1 xml-xalan/test/tests/conf/numbering/numbering90.xsl
Index: numbering90.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<!-- CaseName: numbering90 -->
<!-- Creator: David Marston -->
<!-- Purpose: Test counting only some nodes, with key() in count pattern. -->
<!-- SpecCitation: Rec="XSLT" Version="1.0" type="OASISptr1"
place="id(number)/ulist[2]/item[1]/p[1]/text()[5]" -->
<!-- SpecCitation: Rec="XSLT" Version="1.0" type="OASISptr1"
place="id(number)/ulist[1]/item[2]/p[1]/text()[1]" -->
<!-- SpecCitation: Rec="XSLT" Version="1.0" type="OASISptr1"
place="id(number)/ulist[1]/item[3]/p[1]/text()[1]" -->
<!-- SpecCitation: Rec="XSLT" Version="1.0" type="OASISptr1"
place="id(convert)/p[2]/text()[5]" -->
<!-- SpecCitation: Rec="XSLT" Version="1.0" type="OASISptr1"
place="id(convert)/ulist[1]/item[1]/p[1]/text()[1]" -->
<!-- Scenario: operation="standard-XML" -->
<xsl:key name="key_of_f" match="note" use="@flag"/>
<xsl:template match="doc">
<out>
<xsl:apply-templates/>
</out>
</xsl:template>
<xsl:template match="note">
<xsl:number level="single" from="doc|chapter" count="key('key_of_f','yes')"
format="(1) "/>
<xsl:apply-templates/>
</xsl:template>
</xsl:stylesheet>
1.1 xml-xalan/test/tests/conf/numbering/numbering91.xml
Index: numbering91.xml
===================================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE iddata SYSTEM "iddata.dtd">
<iddata>
<el id="a"/>
<el id="b"/>
<el id="c"/>
<el id="d"/>
<el id="e"/>
<el id="f"/>
<el id="g"/>
<el id="h"/>
</iddata>
1.1 xml-xalan/test/tests/conf/numbering/numbering91.xsl
Index: numbering91.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<!-- CaseName: numbering91 -->
<!-- Creator: David Marston -->
<!-- Purpose: Test counting only some nodes, with id() in count pattern. -->
<!-- SpecCitation: Rec="XSLT" Version="1.0" type="OASISptr1"
place="id(number)/ulist[2]/item[1]/p[1]/text()[5]" -->
<!-- SpecCitation: Rec="XSLT" Version="1.0" type="OASISptr1"
place="id(number)/ulist[1]/item[2]/p[1]/text()[1]" -->
<!-- SpecCitation: Rec="XSLT" Version="1.0" type="OASISptr1"
place="id(number)/ulist[1]/item[3]/p[1]/text()[1]" -->
<!-- SpecCitation: Rec="XSLT" Version="1.0" type="OASISptr1"
place="id(convert)/p[2]/text()[5]" -->
<!-- SpecCitation: Rec="XSLT" Version="1.0" type="OASISptr1"
place="id(convert)/ulist[1]/item[1]/p[1]/text()[1]" -->
<!-- Scenario: operation="standard-XML" -->
<xsl:template match="iddata">
<out>
<xsl:apply-templates/>
</out>
</xsl:template>
<xsl:template match="el">
<xsl:choose>
<xsl:when test="@id='b' or @id='d' or @id='g'">
<xsl:number level="single" from="iddata" count="id('b d g')" format="(1) "/>
</xsl:when>
<xsl:otherwise>
<xsl:text>(no) </xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="@id"/>
</xsl:template>
</xsl:stylesheet>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]