OCLOperators XsltTransformXml
No edit summary
No edit summary
Line 20: Line 20:
</xsl:stylesheet>
</xsl:stylesheet>
</pre>
</pre>
[[Category:OCLOperators]]

Revision as of 12:33, 7 December 2022

Use selfVM.XsltTransformXml(<xsltstring>, <xmlstring>)  transforms xml using the provided XSLT text.

Below is a sample that replace the root node named "root" to "PrspctsDataRpt" - and drops the node named xslt from the output, but keeps everything else intact:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="xml" indent="yes"/>
  <xsl:strip-space elements="*" />
  <xsl:template match="@* | node()">
    <xsl:copy>
      <xsl:apply-templates select="@* | node()"/>
    </xsl:copy>
  </xsl:template>
  <xsl:template match="xslt"/>

 
  <xsl:template match="root">
    <PrspctsDataRpt><xsl:apply-templates select="@*|node()" /></PrspctsDataRpt>
  </xsl:template>
</xsl:stylesheet>
This page was edited 96 days ago on 02/10/2024. What links here