Built-in templates in XSLT


/ Published in: XML
Save to your folder(s)

You need to know about [the presence of] these to understand the processing of an XSLT stylesheet.


Copy this code and paste it in your HTML
  1. <!-- Element or root node: Process children -->
  2. <xsl:template match="* | /">
  3. <xsl:apply-templates />
  4. </xsl:template>
  5.  
  6. <!-- Element or root in specific mode: Process children in that mode -->
  7. <xsl:template match="* | /" mode="m">
  8. <xsl:apply-templates mode="m" />
  9. </xsl:template>
  10.  
  11. <!-- Text or attribute node: Output value -->
  12. <xsl:template match="text() | @*">
  13. <xsl:value-of select="." />
  14. </xsl:template>
  15.  
  16. <!-- PI or comment node: Hide from result -->
  17. <xsl:template match="processing-instruction() | comment()" />

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.