`nth-of-type()'

I propose new PositionExpr `nth-of-type(n)' for XSL.  The result
of nth-of-type(n) is true if the context node is an element and
placed at n-th position in the same element type.

It is required for converting from poor-described tag sets. For
example, if I wanted to convert from Doc-A(see below) to Doc-B,
I wrote a templete like Temp-A. I couldn't find how to select
"2nd td element" in current XSL draft.

Temp-A ----------------------------------------------------------------
<xsl:template match="tr">
 <spec>
  <title><xsl:value-of select="td[first-of-type()]"/></title>
  <uri><xsl:value-of select="td[*** Select 2nd td element! ***]"/></uri>
  <date><xsl:value-of select="td[last-of-type()]"/></date>
 </spec>
</xsl:template>
----------------------------------------------------------------
Doc-A ----------------------------------------------------------------
<table>
 <tr>
  <td>Extensible Markup Language (XML) 1.0</td>
  <td>http://www.w3.org/TR/1998/REC-xml-19980210</td>
  <td>10-Feb-1998</td>
 </tr>
 <tr>
  <td>Document Object Model (DOM) Level 1</td>
  <td>http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001</td>
  <td>1-Oct-1998</td>
 </tr>
 <tr>.....</tr>

</table>
----------------------------------------------------------------
Doc-B  ----------------------------------------------------------------
<specs>
 <spec>
  <title>Extensible Markup Language (XML) 1.0</title>
  <uri>http://www.w3.org/TR/1998/REC-xml-19980210</uri>
  <date>10-Feb-1998</date>
 </spec>
 <spec>
  <title>Document Object Model (DOM) Level 1</title>
  <uri>http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001</uri>
  <date>1-Oct-1998</date>
 </spec>
 <spec>.....</spec>

</specs>
----------------------------------------------------------------


-- 
TAMURA, Kent  @ Tokyo Research Laboratory, IBM Japan

Received on Thursday, 18 February 1999 00:33:56 UTC