Friday, 31 July 2015

XSLT Notes

Cited from the book "XSLT for Dummies"

"apply-templates doesn’t include the tags of the element—only what’s inside the tags"

"Namespaces were developed to avoid this name collision by linking a namespace identifier with a URI (Uniform Resource Identifier)."

"the primary purpose of xsl:copy is to carry over the element tags. However, if you combine it with xsl:apply-templates, you copy both the tags and its content"

"xsl:copy-of duplicates everything inside the current node. "

 "The select attribute of the xsl:copy-of element determines what is copied to the result tree."

"<xsl:value-of select="expression"/>"

==================================================
matching element nodes
<xsl:template match="*|/">
<xsl:apply-templates/>
</xsl:template>

matching text and attribute nodes

<xsl:template match="text()|@*">
<xsl:value-of select="."/>
</xsl:template>

matching processing instructions and comments
<xsl:template match="processing-instruction()|comment()"/>

"An XPath expression for matching a namespace node doesn’t exist."
==================================================
child axis: child:: or omitted by default.

attribute axis: attribute:: or @ by shorthand.

node() is a node test that matches any node whatever kind it is.

chapter[position()=1]

chapter[last()]
==================================================







No comments:

Post a Comment