0

I have an XSL file and in this file there are statements:

 <xsl:apply-templates select=".//text"/>.

Can anyone tell me what does select = ".//" mean?

I know the '.' is current node, but for'//' is?

Keren Caelen
  • 1,466
  • 3
  • 17
  • 38
7 rn
  • 5
  • 2
  • 1
    In addition to Martin Honnen's answer, it is also worth pointing out that `text` is not the same as `text()`. Where you see just `text`, that is looking for an element named `text` (e.g. `My text`), whereas `text()` would be looking for text nodes (e.g. just the "My text" bit). – Tim C Jun 04 '18 at 09:04
  • See also [**What is the difference between .// and //* in XPath?**](https://stackoverflow.com/q/35606708/290085) – kjhughes Jun 04 '18 at 14:36
  • Thanks for pointing out – 7 rn Jun 05 '18 at 12:23

1 Answers1

0

The expression language in XSLT is XPath and in XPath https://www.w3.org/TR/xpath-31/#abbrev // is an abbreviation for /descendant-or-self::node()/ so .//text is short for ./descendant-or-self::node()/text which means it selects, relative to the context node, all descendant elements with the name text.

Martin Honnen
  • 160,499
  • 6
  • 90
  • 110