W3C home > Mailing lists > Public > xsl-editors@w3.org > January to March 1999

`nth-of-type()'

From: TAMURA Kent <kent@trl.ibm.co.jp>
Date: Thu, 18 Feb 1999 14:33:42 +0900
Message-Id: <199902180533.OAA20898@ns.trl.ibm.com>
To: xsl-editors@w3.org
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 7 December 2009 10:59:49 GMT