XSL Common Templates

Submitted by code_admin on Wed, 07/25/2018 - 10:25

Play with these here Sandbox

Copy All Attributes

Template that will copy attributes

  1.   <xsl:template match="@*">
  2.     <xsl:attribute name="{name(.)}"><xsl:value-of select="."/></xsl:attribute>
  3.   </xsl:template>

Call this template with:

  1. <xsl:apply-templates select="/inp1:TestHandInRectMsg/inp1:P_VARCHAR2_DATA/@*"/>

Supress Text

Place at the end of a document you don't want text to come out of.

  1. <xsl:template match="text()">
  2. </xsl:template>

XSL Identity Template

Output exactly what is input

  1.   <xsl:template match="@*|*|processing-instruction()|comment()">
  2.     <xsl:copy>
  3.       <xsl:apply-templates select="*|@*|text()|processing-instruction()|comment()"/>
  4.     </xsl:copy>
  5.   </xsl:template>

Tags

RJM Article Type
Work Notes