Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is // in XSLT?

Tags:

xslt

xpath

What is // in XSLT? (e.g. $currentPage//node)

like image 681
user335160 Avatar asked Jul 27 '10 05:07

user335160


People also ask

What is XSLT explain with example?

XSLT Processor takes the XSLT stylesheet and applies the transformation rules on the target XML document and then it generates a formatted document in the form of XML, HTML, or text format. This formatted document is then utilized by XSLT formatter to generate the actual output which is to be displayed to the end-user.

What does XSLT stand for?

Extensible Stylesheet Language Transformations (XSLT) is an XML-based language used, in conjunction with specialized processing software, for the transformation of XML documents.

What is difference between XML and XSLT?

XSLT (eXtensible Stylesheet Language Transformations) is the recommended style sheet language for XML. XSLT is far more sophisticated than CSS. With XSLT you can add/remove elements and attributes to or from the output file.

What is text () in XSLT?

XSLT <xsl:text> The <xsl:text> element is used to write literal text to the output. Tip: This element may contain literal text, entity references, and #PCDATA.


1 Answers

what // in xslt? e.g. ($currentPage//node)

In XPath the abbreviation:

// is short for /descendant-or-self::node()/

The value of some attributes of xslt instructions (such as the select attribute) must be an XPath expression.

Therefore,

($currentPage//node)

stands for

($currentPage/descendant-or-self::node()/node)

This selects all elements named node that are children of nodes that are either contained in the variable $currentPage or are descendents of nodes that are contained in the variable $currentPage.

Do note that in the provided expression node() is a node-test (it selects all node types on the descendant-or-self:: axis, such as elements, text nodes, comments and processing-instructions.

On the other side, somePath/node is a shorthand for somePath/child::node and only selects elements named node that are children of the context node.

I strongly recommend not to use the name node for an element in order to avoid this confusion.

like image 109
Dimitre Novatchev Avatar answered Nov 04 '22 02:11

Dimitre Novatchev