Witam,
W SQL w Oracle’u istnieje możliwość wykorzystania transformat XSLT przekształcających jeden dokument XML w inny. Transformata XSLT sama w sobie jest zapisana w języku XML. Realizacja transformaty możliwa jest z wykorzystaniem funkcji XMLTransform przyjmującej jako parametry przekształcany dokument oraz transformatę, a zwracającą zmodyfikowany dokument. Przykład:
SELECT XMLTransform(XMLType.createXML('<list><shortdesc>opis krótki</shortdesc><name>nazwa</name><desc>opis</desc></list>'),
XMLTYPE.createxml(
'<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:output encoding="utf-8"/>
<xsl:template match="*">
<xsl:copy>
<xsl:apply-templates select="*|text()">
<xsl:sort select="name(.)" data-type="text" order="ascending"/>
</xsl:apply-templates>
</xsl:copy>
</xsl:template>
<xsl:template match="text()">
<xsl:value-of select="normalize-space(.)"/>
</xsl:template>
</xsl:stylesheet> ')).getStringVal() FROM dual;