This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: matching nodes by their value



Hello again,

After some experiments I found out that both
<xsl:for-each select="tr/td[position()=2/a[starts-with(.,$string)]">
and
<xsl:for-each
select="tr/td[position()=2]/a[starts-with(tr/td[position()=2]/a,$string)]">.
work the same, so the problem probably somewhere else.

I have such html:
<html>
<head><title>Title</title></head>
<body>
<table><tr><td>..</td></tr></table>
<table>
<tr>
<td><a href="http://">..</a></td>
<td><a href="http://">AAA</a></td>
</tr><tr>
<td><a href="http://">..</a></td>
<td><a href="http://">BBB</a></td>
</tr>
</table>
</body>
</html>

and xsl I am trying to use looks like this:
...
  <xsl:template match="table[position()=2]">
    <p>
    <xsl:element name="table">
       <xsl:attribute name="columns">1</xsl:attribute>
      <xsl:apply-templates
select="tr/td[position()=2]/a[starts-with(tr/td[position()=2]/a,'A')]"/>
    </xsl:element>
    </p>
  </xsl:template>
 <xsl:template match="td[position()=2]/a">
   <tr><td>
       <xsl:value-of select="."/>
   </td></tr>
  </xsl:template>

the result I get:
<p><table columns="1"/></p>

if  starts-with(tr/td[position()=2]/a,'A')
is changed to  starts-with(tr/td[position()=2]/a,'')
then the result is:
<p><table columns="1"><tr><td>AAA</td></tr><tr><td>BBB</td></tr></table></p>

That looks strange for me. What can be wrong here?

Jonas.


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]