Xpath: select div that contains class AND whose specific child element contains text

To find a div of a certain class that contains a span at any depth containing certain text, try: //div[contains(@class, ‘measure-tab’) and contains(.//span, ‘someText’)] That said, this solution looks extremely fragile. If the table happens to contain a span with the text you’re looking for, the div containing the table will be matched, too. I’d … Read more

case-insensitive matching in XPath?

XPath 2 has a lower-case (and upper-case) string function. That’s not quite the same as case-insensitive, but hopefully it will be close enough: //CD[lower-case(@title)=’empire burlesque’] If you are using XPath 1, there is a hack using translate.

Selecting a css class with xpath

I want to write the canonical answer to this question because the answer above has a problem. Our problem The CSS selector: .foo will select any element that has the class foo. How do you do this in XPath? Although XPath is more powerful than CSS, XPath doesn’t have a native equivalent of a CSS … Read more

XPath: difference between dot and text()

There is a difference between . and text(), but this difference might not surface because of your input document. If your input document looked like (the simplest document one can imagine given your XPath expressions) Example 1 <html> <a>Ask Question</a> </html> Then //a[text()=”Ask Question”] and //a[.=”Ask Question”] indeed return exactly the same result. But consider … Read more

XPath and XSLT 2.0 for .NET? [closed]

I don’t think they’ll add support for XPath 2.0 or XSLT 2.0 any time soon. However, you shouldn’t feel bad if these are not part of the BCL, as long as you have 3rd party implementations available: Saxon: XPath 3.1, XQuery 3.1, XSLT 3.0 XmlPrime: XPath 3.1, XQuery 3.1, XSLT 2.0 QueryMachine: XPath 2.0, XQuery … Read more

XSLT string replace

replace isn’t available for XSLT 1.0. Codesling has a template for string-replace you can use as a substitute for the function: <xsl:template name=”string-replace-all”> <xsl:param name=”text” /> <xsl:param name=”replace” /> <xsl:param name=”by” /> <xsl:choose> <xsl:when test=”$text=”” or $replace=””or not($replace)” > <!– Prevent this routine from hanging –> <xsl:value-of select=”$text” /> </xsl:when> <xsl:when test=”contains($text, $replace)”> <xsl:value-of select=”substring-before($text,$replace)” … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)