OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

xslt-conformance message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]


Subject: Samples of annotated test cases (long)


This is a follow-up to the message I sent yesterday. The set of cases
below control for just one aspect of xsl:number, namely the different
"normal" possibilities for the count attribute.
numbering19: count not specified (default is same-named nodes, roughly)
numbering64: count is just one element name
numbering65: count is a union of several element names
numbering66: count has element names filtered by a predicate
In all four cases, level="multiple", from is specified, and a format
is specified. Some of these might not be real-world examples, but they
were written to fill out a matrix of possibilities.

Annotation of CaseName, Author, Purpose, and Scenario is per the
WoodenMan proposal. The comments would be extracted to become TestCase
entries in the catalog of this test suite. We have an open question
about saying "case-name" in place of "CaseName"; your comments are
solicited. ("Case-Name" and "Case-name" are also possible.)

Now let's look at the pointers in the "SpecCitation" entries.
Pointer id(number)/ulist[2]/item[2]/p[1]/text()[5] is the place within
the level="multiple" bullet item where its interaction with a specified
from attribute is discussed. More exactly, it's first piece of text()
that is fully within the first sentence on that subject.
Pointer id(number)/ulist[1]/item[3]/p[1]/text()[1] is the beginning of
the bullet item about the from attribute. I use the presence of this to
signify that from is specified rather than defaulted.
Pointer id(convert)/p[2]/text()[5] is a reference to characters that
are treated as start, end, and separators in the format. This text()
piece has about five full sentences.
Pointer id(convert)/ulist[1]/item[1]/p[1]/text()[1] refers to the "1"
format, and higher-numbered item[n] pointers refer to "A" and "a".

That leaves the pointers that apply to count, which I'm varying here.
Pointer id(number)/ulist[1]/item[2]/p[1]/text()[1] is at the
beginning of the bullet item about count. Notice that I have no good
way to say how 64/65/66 differ using references to 7.7, because the item
just says count is a pattern. Should I chase down references to unions
and predicates in the pattern language, which might fall through to
expressions?
The numbering19 case has no pointer for count, though I could have
used id(number)/ulist[1]/item[2]/p[1]/text()[3] to mark the sentence
about the default for count. Explicitly noting when defaults are relied
upon would require some rules for citation. (For example, the whole
stylesheet relies upon apply-templates with all defaulted attributes
having a certain behavior, but that's not the point of the test.)

As you look at the stylesheets below (sorry about the line wrapping),
think about the process of deciding whether we have full coverage of
xsl:number. Then think about whether these tests should also count as
coverage of the pattern language. Staring at these pointers will grow
tiring quickly, but how many more citation rules are needed to make
them suitable for machine-aided analysis?
.................David Marston

numbering19.xsl:
================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version
="1.0">

  <!-- CaseName: numbering19 -->
  <!-- Author: David Marston -->
  <!-- Purpose: Test of node numbering before and after the nodes specified
in from. -->
  <!-- SpecCitation: Rec="XSLT" Version="1.0" type="OASISptr1" place
="id(number)/ulist[2]/item[2]/p[1]/text()[5]" -->
  <!-- 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="doc">
  <out>
    <xsl:apply-templates/>
  </out>
</xsl:template>

<xsl:template match="note">
  <xsl:number level="multiple" from="chapter" format="(1) "/>
  <xsl:apply-templates/>
</xsl:template>

</xsl:stylesheet>

numbering64.xsl:
================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version
="1.0">

  <!-- CaseName: numbering64 -->
  <!-- Author: David Marston -->
  <!-- Purpose: Test xsl:number with count on same level, from is next
higher level, level=multiple. -->
  <!-- SpecCitation: Rec="XSLT" Version="1.0" type="OASISptr1" place
="id(number)/ulist[2]/item[2]/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)/ulist[1]/item[1]/p[1]/text()[1]" -->
  <!-- Scenario: operation="standard-XML" -->

<xsl:template match="doc">
  <out><xsl:apply-templates/></out>
</xsl:template>

<xsl:template match="note">
  <xsl:number level="multiple" from="chapter" count="note" format
="1"/><xsl:text>: </xsl:text><xsl:value-of select="."/><xsl:text>
</xsl:text>
</xsl:template>

<xsl:template match="text()"><!-- To suppress empty lines
--><xsl:apply-templates/></xsl:template>

</xsl:stylesheet>

numbering65.xsl:
================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version
="1.0">

  <!-- CaseName: numbering65 -->
  <!-- Author: David Marston -->
  <!-- Purpose: Test of numbering of multi-level document with specified
from level, level=multiple. -->
  <!-- SpecCitation: Rec="XSLT" Version="1.0" type="OASISptr1" place
="id(number)/ulist[2]/item[2]/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="doc">
  <out><xsl:apply-templates/></out>
</xsl:template>

<xsl:template match="title">
    <xsl:number level="multiple" from="a" count="b|c|d|e" format
="1-1"/><xsl:text>: </xsl:text><xsl:value-of select="."/><xsl:text>
</xsl:text>
</xsl:template>

<xsl:template match="text()"><!-- To suppress empty lines
--><xsl:apply-templates/></xsl:template>

</xsl:stylesheet>

numbering66.xsl:
================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version
="1.0">

  <!-- CaseName: numbering66 -->
  <!-- Author: David Marston -->
  <!-- Purpose: Test of numbering of multi-level document with specified
from level, count filtered. -->
  <!-- SpecCitation: Rec="XSLT" Version="1.0" type="OASISptr1" place
="id(number)/ulist[2]/item[2]/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]" -->
  <!-- SpecCitation: Rec="XSLT" Version="1.0" type="OASISptr1" place
="id(convert)/ulist[1]/item[2]/p[1]/text()[1]" -->
  <!-- SpecCitation: Rec="XSLT" Version="1.0" type="OASISptr1" place
="id(convert)/ulist[1]/item[3]/p[1]/text()[1]" -->
  <!-- Scenario: operation="standard-XML" -->

<xsl:template match="doc">
  <out>
    <xsl:apply-templates/>
  </out>
</xsl:template>

<xsl:template match="chapter//title">
  <xsl:number level="multiple" from="chapter"
      count="chapter|section|subsection[1]"
      format="A.1.a. "/>
  <xsl:value-of select="."/><xsl:text>
</xsl:text>
</xsl:template>

<xsl:template match="text()"><!-- To suppress empty lines
--><xsl:apply-templates/></xsl:template>

</xsl:stylesheet>



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]


Powered by eList eXpress LLC