invantive-dokumentationen del av Invantive Cloud
Invantive supportforumLogga in / Registrera dig

XMLTRANSFORM

Syntax

%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    Start((START)) --> XMLTRANSFORM[XMLTRANSFORM]:::quoted
    XMLTRANSFORM --> End((END))

Syfte

The XMLTRANSFORM SQL functions applies an XSL style sheet to the XML instance.

See also XMLCOMMENT, XMLDECODE, XMLELEMENT, XMLENCODE and XMLFORMAT.

Parametrar:

  • XML (varchar2): XML type instance to be transformed with the XSL style sheet.
  • Style sheet (varchar2): The XSL style sheet to apply.

Returns: the XML instance with the style sheet applied to it.

Exempel

The following example extracts the value of the element name from an XML instance using an XSL style sheet:

select xmltransform
       ( '<?xml version="1.0"?><name>peter</name>'
       , '<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"><xsl:output method="html" indent="yes"/><xsl:template match="/"><xsl:value-of select="name"/></xsl:template></xsl:stylesheet>'
       )

-------------------
peter

The following example extracts the value of the element first-name from an XML instance with multiple child elements using an XSL style sheet:

select xmltransform
       ( '<?xml version="1.0"?><r><name>peter overlap</name><first-name>peter</first-name></r>'
       , '<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"><xsl:output method="html" indent="yes"/><xsl:template match="/r"><xsl:value-of select="first-name"/></xsl:template></xsl:stylesheet>'
       )

-------------------
peter