Skip to content

Instantly share code, notes, and snippets.

@Dviejopomata
Created October 31, 2016 07:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Dviejopomata/c61888e79328ae570c72ffa0ae0a2583 to your computer and use it in GitHub Desktop.
Save Dviejopomata/c61888e79328ae570c72ffa0ae0a2583 to your computer and use it in GitHub Desktop.
xsl que convierte lo nombres de los elementos a mayusculas
declare
xml xmltype:= xmltype('
<root>
<a k="2">
<b j="2">aaa</b>
</a>
</root>
');
xsl xmltype:= xmltype(
'
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:variable name="smallcase" select="''abcdefghijklmnopqrstuvwxyz''" />
<xsl:variable name="uppercase" select="''ABCDEFGHIJKLMNOPQRSTUVWXYZ''" />
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="*">
<xsl:element name="{translate(name(.),$smallcase,$uppercase)}">
<xsl:apply-templates select="@*|node()" />
</xsl:element>
</xsl:template>
</xsl:stylesheet>
'
);
result xmltype;
begin
SELECT XMLtransform(xml, xsl.getstringval()) into result FROM dual;
dbms_output.put_line(result.getstringval());
end;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment