| | |
XPath expression for <td> tag having "Type" as textContent in any of its childNodes
Please support our XML, XSLT and XPATH advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Dec 2006
Posts: 1
Reputation:
Solved Threads: 0
XPath expression for <td> tag having "Type" as textContent in any of its childNodes
-1
#1 Aug 29th, 2009
I have a HTML document in which there is a <td> tag
In this td tag the TextContent is equal to "Type"
It is not neccessary that the td tag directly has content,it may have content in the subtags.
The "Type" stuff may be enclosed in between the spaces
What will be the XPath expression for the same?
Thanks in advance
CSJakharia
In this td tag the TextContent is equal to "Type"
It is not neccessary that the td tag directly has content,it may have content in the subtags.
The "Type" stuff may be enclosed in between the spaces
What will be the XPath expression for the same?
XML, XSLT and XPATH Syntax (Toggle Plain Text)
<td align="left" style="background-color:#648190;"><span style="color:#ffffff;font-family:arial;font-size:small;"><b> Type</b></span></td>
Thanks in advance
CSJakharia
•
•
Join Date: Oct 2008
Posts: 95
Reputation:
Solved Threads: 5
Re: XPath expression for <td> tag having "Type" as textContent in any of its childNod
0
#2 Sep 6th, 2009
Assuming the following example HTML file as input
The following stylesheet will output the node-set containing the string "Type" in any text node.
XML, XSLT and XPATH Syntax (Toggle Plain Text)
<html> <head></head> <body> <td align="left" style="background-color:#648190;"><span style="color:#ffffff;font-family:arial;font-size:small;"><b> Type</b></span></td> <td align="left" style="background-color:#648190;"> Value</td> </body> </html>
XML, XSLT and XPATH Syntax (Toggle Plain Text)
<?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="xml"/> <xsl:template match="/html//td"> <xsl:if test=".//text()[contains(., 'Type')]"> <xsl:copy-of select="." /> </xsl:if> </xsl:template> <xsl:template match="/"> <xsl:apply-templates select="/html//td" /> </xsl:template> </xsl:stylesheet>
![]() |
Similar Threads
- using HTML input type = "file" (ColdFusion)
- How to retain value in <input type="file" name=" "> after self submitting (reload) (JSP)
- generating form (PHP)
- Address Type: "Automatic Private Address" (?) (Networking Hardware Configuration)
- help understanding "char" data type (C++)
- Cast from string "Display" to type "Interger" is not valid (VB.NET)
- google "keyword" question (Search Engine Optimization)
Other Threads in the XML, XSLT and XPATH Forum
- Previous Thread: Xpath Corelate Parent With Variable number Of Children
- Next Thread: [PHP] How to change a value with XPath
| Thread Tools | Search this Thread |
api blogger blogging code delete development dynamiccreationofnvariablesinxslt error firstthreecharacterofastringrequired flipbook gdata google html include java link linspire linux microsoft news node openoffice overwrite precedence programming rss standards swf template transform variable w3c web xml xmlnotloading xmlonserver xsl xslt





