Topic: xslt,xpath problems |
|
---|---|
Author | Thread |
Neurotic (0) Inmate Newly admitted From: |
posted 07-13-2005 16:28
dear all, code: -<tr> - <td align="left" valign="top"> <img height="1" src="http://pics.ebaystatic.com/aw/pics/s.gif" width="10" /> 13-Jul-2005 13:26:47 IST </td> </tr>
code: tr[1]/td/img/text()
|
Maniac (V) Mad Scientist From: 100101010011 <-- right about here |
posted 07-13-2005 17:30
Sorry just cleaned up the path using square brackets like that can break in the board |
Obsessive-Compulsive (I) Inmate From: |
posted 07-13-2005 17:53
hi hi, code: tr[i]/td/img/text()
|
Maniac (V) Mad Scientist From: Rochester, New York, USA |
posted 07-13-2005 19:34
If you are using XSLT why not use XSLT, that is what the <xsl:for-each/> loop or the <xsl:apply-templates/> is for. |
Nervous Wreck (II) Inmate From: |
posted 07-13-2005 20:19
hi hi, code: - <tr> - <td bgcolor="#ffffff" colspan="10" height="2"> <img alt="" height="1" src="http://pics.ebaystatic.com/aw/pics/x.gif" title="" width="100%" /> </td> </tr> - <tr bgcolor="#ffffff"> - <td height="20" valign="middle" width="10"> <img alt="" height="20" src="http://pics.ebaystatic.com/aw/pics/x.gif" title="" width="10" /> </td> - <td align="left"> <a href="http://contact.ebay.in/ws/eBayISAPI.dll?ReturnUserEmail&requested=naveen71&iid=8316776438&frm=992">naveen71</a> <img border="0" src="http://pics.ebaystatic.com/aw/pics/s.gif" width="4" /> ( <a href="http://feedback.ebay.in/ws/eBayISAPI.dll?ViewFeedback&userid=naveen71">2</a> ) </td> <td align="middle" nowrap="nowrap" valign="top">Rs. 349.00</td> <td align="middle" valign="top">1</td> - <td align="left" valign="top"> <img height="1" src="http://pics.ebaystatic.com/aw/pics/s.gif" width="10" /> 06-Jul-2005 18:04:26 IST </td> - <td> <img alt="" height="1" src="http://pics.ebaystatic.com/aw/pics/x.gif" title="" width="1" /> </td> </tr> - <tr> - <td bgcolor="#f9f9f9" colspan="10" height="2"> <img alt="" height="1" src="http://pics.ebaystatic.com/aw/pics/x.gif" title="" width="100%" /> </td> </tr> - <tr bgcolor="#f9f9f9"> - <td height="20" valign="middle" width="10"> <img alt="" height="20" src="http://pics.ebaystatic.com/aw/pics/x.gif" title="" width="10" /> </td> - <td align="left"> <a href="http://contact.ebay.in/ws/eBayISAPI.dll?ReturnUserEmail&requested=sweetsam84&iid=8316776438&frm=992">sweetsam84</a> <img border="0" src="http://pics.ebaystatic.com/aw/pics/s.gif" width="4" /> ( <a href="http://feedback.ebay.in/ws/eBayISAPI.dll?ViewFeedback&userid=sweetsam84">0</a> ) </td> <td align="middle" nowrap="nowrap" valign="top">Rs. 349.00</td> <td align="middle" valign="top">1</td> - <td align="left" valign="top"> <img height="1" src="http://pics.ebaystatic.com/aw/pics/s.gif" width="10" /> 07-Jul-2005 09:42:50 IST </td> - <td> <img alt="" height="1" src="http://pics.ebaystatic.com/aw/pics/x.gif" title="" width="1" /> </td> </tr>
code: <xsl:template match="table[starts-with(normalize-space(tr/td[2]/span/b/text()),'User ID:')]"> <xsl:for-each select="tr[$counter+1]"> <buyer> <xsl:value-of select="td[2]/a/text()"/> </buyer> <price> <xsl:value-of select="td[3]/text()"/> </price> </xsl:for-each> </xsl:template>
code: tr[1] , tr[2]
|
Maniac (V) Mad Scientist From: Rochester, New York, USA |
posted 07-13-2005 23:46
Your for-each looks fine if you lose the square braces, you then should be fine to match against every <tr>. |
Nervous Wreck (II) Inmate From: |
posted 07-14-2005 04:22
hi hi code: - <table border="0" cellpadding="0" cellspacing="0" width="100%"> - <tr bgcolor="#efefef"> - <td valign="middle" width="10"> <img alt="" height="20" src="http://pics.ebaystatic.com/aw/pics/x.gif" title="" width="10" /> </td> - <td nowrap="nowrap" valign="middle" width="35%"> - <span class="standarditle"> <b>User ID:</b> </span> </td> <td align="center" class="standardtitle" nowrap="nowrap" valign="middle" width="25%">Price</td> <td align="center" class="standardtitle" valign="middle" width="5%">Qty</td> <td align="left" bgcolor="#cccccc" class="standardtitle" nowrap="nowrap" valign="middle" width="35%">Date of Purchase</td> - <td> <img alt="" src="http://pics.ebaystatic.com/aw/pics/x.gif" title="" width="10" /> </td> </tr> - <tr> - <td bgcolor="#ffffff" colspan="10" height="2"> <img alt="" height="1" src="http://pics.ebaystatic.com/aw/pics/x.gif" title="" width="100%" /> </td> </tr> - <tr bgcolor="#ffffff"> - <td height="20" valign="middle" width="10"> <img alt="" height="20" src="http://pics.ebaystatic.com/aw/pics/x.gif" title="" width="10" /> </td> - <td align="left"> <a href="http://contact.ebay.in/ws/eBayISAPI.dll?ReturnUserEmail&requested=naveen71&iid=8316776438&frm=992">naveen71</a> <img border="0" src="http://pics.ebaystatic.com/aw/pics/s.gif" width="4" /> ( <a href="http://feedback.ebay.in/ws/eBayISAPI.dll?ViewFeedback&userid=naveen71">2</a> ) </td> <td align="middle" nowrap="nowrap" valign="top">Rs. 349.00</td> <td align="middle" valign="top">1</td> - <td align="left" valign="top"> <img height="1" src="http://pics.ebaystatic.com/aw/pics/s.gif" width="10" /> 06-Jul-2005 18:04:26 IST </td> - <td> <img alt="" height="1" src="http://pics.ebaystatic.com/aw/pics/x.gif" title="" width="1" /> </td> </tr> - <tr> - <td bgcolor="#f9f9f9" colspan="10" height="2"> <img alt="" height="1" src="http://pics.ebaystatic.com/aw/pics/x.gif" title="" width="100%" /> </td> </tr> - <tr bgcolor="#f9f9f9"> - <td height="20" valign="middle" width="10"> <img alt="" height="20" src="http://pics.ebaystatic.com/aw/pics/x.gif" title="" width="10" /> </td> - <td align="left"> <a href="http://contact.ebay.in/ws/eBayISAPI.dll?ReturnUserEmail&requested=sweetsam84&iid=8316776438&frm=992">sweetsam84</a> <img border="0" src="http://pics.ebaystatic.com/aw/pics/s.gif" width="4" /> ( <a href="http://feedback.ebay.in/ws/eBayISAPI.dll?ViewFeedback&userid=sweetsam84">0</a> ) </td> <td align="middle" nowrap="nowrap" valign="top">Rs. 349.00</td> <td align="middle" valign="top">1</td> - <td align="left" valign="top"> <img height="1" src="http://pics.ebaystatic.com/aw/pics/s.gif" width="10" /> 07-Jul-2005 09:42:50 IST </td> - <td> <img alt="" height="1" src="http://pics.ebaystatic.com/aw/pics/x.gif" title="" width="1" /> </td> </tr> </table> |
Nervous Wreck (II) Inmate From: |
posted 07-14-2005 08:26
hi, code: <buyer> naveen71 </buyer> <buyer> sweetsam84 </buyer>
code: <buyer_$counter> naveen71 </buyer> <buyer_$counter+1> sweetsam84 </buyer>
|
Maniac (V) Mad Scientist From: Rochester, New York, USA |
posted 07-14-2005 15:41
You might be able to key off of the TR count. |
Nervous Wreck (II) Inmate From: |
posted 07-14-2005 18:33
hi, code: <xsl:param name="counter" select="'2'"/> ........ .......... <xsl:template match="table[starts-with(normalize-space(tr/td[2]/span/b/text()),'User ID:')]"> <xsl:for-each select="tr"> <xsl:element name="$buyer"> <xsl:value-of select="td[2]/a/text()"/> <xsl:value-of select="$counter+1"/> </xsl:element> </xsl:template>
code: <2> value 3 </2>
|
Maniac (V) Mad Scientist From: Rochester, New York, USA |
posted 07-14-2005 18:55
I would do the following. code: <xsl:template match="your crazy table match"> <xsl:for-each select="tr"> <buyer> <name><xsl:value-of select="select the name"/></name> <number><xsl:value-of select="position()"/></number> </buyer> </xsl:for-each> </xsl:template>
|
Paranoid (IV) Inmate From: Cold Sweden |
posted 07-14-2005 18:59
quote:
quote:
code: $counter+position() or just code: position() as WarMage said. |
Nervous Wreck (II) Inmate From: |
posted 07-14-2005 19:16
hi, code: <buyer_name1>naveen71</buyer_name1> <buyer_name2>sweetsam84</buyer_name2>
|
Paranoid (IV) Inmate From: Cold Sweden |
posted 07-14-2005 19:36
code: <xsl:element name="buyer_name{position()}">[element content]</xsl:element>
code: <buyer id="1">...</buyer> <buyer id="2">...</buyer>
|
Nervous Wreck (II) Inmate From: |
posted 07-14-2005 20:02
hi hi code: <xsl:template match="your crazy table match"> <xsl:for-each select="tr"> <xsl:if test="name != a"> <buyer> <name><xsl:value-of select="select the name"/></name> <number><xsl:value-of select="position()"/></number> </buyer> </xsl:if> </xsl:for-each> </xsl:template>
|
Paranoid (IV) Inmate From: Cold Sweden |
posted 07-14-2005 20:18
quote:
code: <xsl:if test="td != a"> |
Nervous Wreck (II) Inmate From: |
posted 07-14-2005 20:45
hi, code: <table> <tr> <td>A</td> </tr> <tr> <td>B</td> </tr> </table>
code: <xsl:for-each select="tr"> <xsl:if test="tdtext() != A"> <buyer_name> <xsl:value-of select="td/text()"/> </buyer_name> </xsl:if> </xsl:for-each>
|
Paranoid (IV) Inmate From: Cold Sweden |
posted 07-14-2005 20:52
I made an error up there. Use: code: <xsl:if test="td/text() != 'A'"> |
Nervous Wreck (II) Inmate From: |
posted 07-14-2005 21:05
hi hi, |
Nervous Wreck (II) Inmate From: |
posted 07-15-2005 11:09
hi hi, code: <xsl:if test="td/text() != ' Cashier's Check '">
|
Paranoid (IV) Inmate From: Cold Sweden |
posted 07-15-2005 15:28
code: <xsl:if test='td/text() != " Cashier's Check "'> |
Nervous Wreck (II) Inmate From: |
posted 07-15-2005 16:41
hi hi, thanks so much code: - <tr> - <td> <p class="plabelb">Shipping fee: $1.00</p> </td> </tr> - <tr> - <td> <p class="plabelb">The seller has chosen the following shipping services:</p> </td> </tr>
|
Bipolar (III) Inmate From: Minnesota |
posted 07-15-2005 17:01
XSLT has a substring function, but what I think you're looking for is the contains function. |
Nervous Wreck (II) Inmate From: |
posted 07-17-2005 19:40
hi there, code: <xsl:if test="position() = '6' "> <xsl:if test = "TD/P/text() = 'Time Left:'"> <xsl:variable name="n" select=" 'A' "/> </xsl:if> </xsl:if> <xsl:if test="position() = '8' "> <xsl:if test = "TD/P/text() = 'Time Left:'"> <xsl:variable name="n" select=" 'B' "/> </xsl:if> </xsl:if>
|