Change the Name of the element with Find and Replace - xslt

Using Find and Replace (XSLT), how to remove element and create new element.
Found Pattern is : <String ID="p1_w5" CONTENT="Human" HPOS="261.948" VPOS="75.8759" STYLEREFS="font1"/>
Replace Pattern Expect this : <b>Human</b>.
Note <bold> is rename with <b> tag and <superscript> is renamed with <sup> as per HTML. How do achieve my requirements using XSLT?
My Current Input XML File is :
<?xml version="1.0" encoding="UTF-8"?>
<ALTO>
<STYLES>
<TextStyle ID="font1" FONTFAMILY="cambria" FONTSIZE="12.000" FONTSTYLE="bold"/>
<TextStyle ID="font2" FONTFAMILY="cambria" FONTSIZE="7.920" FONTSTYLE="sup"/>
<TextStyle ID="font3" FONTFAMILY="cambria" FONTSIZE="12.000" FONTSTYLE="it"/>
</STYLES>
<LAYOUT>
<TextBlock ID="p1_b1" HPOS="83.6703" VPOS="75.8759" HEIGHT="10.6680" WIDTH="445.700">
<TextLine WIDTH="445.700" HEIGHT="10.6680" ID="p1_t1" HPOS="83.6703" VPOS="75.8759">
<String ID="p1_w1" CONTENT="Hie" HPOS="83.6703" VPOS="75.8759" STYLEREFS="font0"/>
<String ID="p1_w2" CONTENT="org" HPOS="154.915" VPOS="75.8759" STYLEREFS="font0"/>
<String ID="p1_w3" CONTENT="of" HPOS="228.005" VPOS="75.8759" STYLEREFS="font0"/>
<String ID="p1_w4" CONTENT="the" HPOS="241.393" VPOS="75.8759" STYLEREFS="font0"/>
<String ID="p1_w5" CONTENT="Human" HPOS="261.948" VPOS="75.8759" STYLEREFS="font1"/>
<String ID="p1_w6" CONTENT="cell" HPOS="303.263" VPOS="75.8759" STYLEREFS="font0"/>
<String ID="p1_w8" CONTENT="a" HPOS="354.900" VPOS="75.8759" STYLEREFS="font0"/>
<String ID="p1_w9" CONTENT="CANCER" HPOS="363.965" VPOS="75.8759" STYLEREFS="font3"/>
</TextLine>
</TextBlock>
</LAYOUT>
</ALTO>
XSLT is:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="#all"
version="3.0">
<xsl:output method="xhtml" use-character-maps="m1" indent="no"/>
<xsl:character-map name="m1">
<xsl:output-character character="<" string="<"/>
<xsl:output-character character=">" string=">"/>
</xsl:character-map>
<xsl:preserve-space elements="*"/>
<xsl:template match="/|node()|*|#*">
<xsl:copy>
<xsl:apply-templates select="node() | * | #*"/>
</xsl:copy>
</xsl:template>
<xsl:param name="styletag1" select="TextStyle[#FONTSTYLE = 'superscript']"/>
<xsl:param name="styletag2" select="TextStyle[#FONTSTYLE = 'it']"/>
<xsl:param name="styletag3" select="TextStyle[#FONTSTYLE = 'bold']"/>
<xsl:template match="/|node()|*|#*">
<xsl:copy>
<xsl:apply-templates select="node() | * | #*"/>
</xsl:copy>
</xsl:template>
<xsl:key name="text-style" match="TextStyle/#FONTSTYLE" use="../#ID"/>
<xsl:mode on-no-match="shallow-copy"/>
<xsl:template match="String[key('text-style', #STYLEREFS)]/#CONTENT">
<xsl:attribute name="{name()}" select="'<' || key('text-style', ../#STYLEREFS) || '>' || . || '</' || key('text-style', ../#STYLEREFS) || '>'"/>
</xsl:template>
</xsl:stylesheet>

A slight adaption of the code in the answer to your previous question
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="#all"
expand-text="yes"
version="3.0">
<xsl:output indent="yes"/>
<xsl:key name="text-style" match="TextStyle" use="#ID"/>
<xsl:mode on-no-match="shallow-skip"/>
<xsl:template match="String[key('text-style', #STYLEREFS)]">
<xsl:variable name="replacement" as="node()*">
<xsl:element name="{key('text-style', #STYLEREFS)/#FONTSTYLE}">{#CONTENT}</xsl:element>
</xsl:variable>
<xsl:apply-templates select="$replacement" mode="fix-html"/>
</xsl:template>
<xsl:mode name="fix-html" on-no-match="shallow-copy"/>
<xsl:template mode="fix-html" match="bold">
<b>
<xsl:apply-templates mode="#current"/>
</b>
</xsl:template>
</xsl:stylesheet>
transforms
<?xml version="1.0" encoding="UTF-8"?>
<ALTO>
<STYLES>
<TextStyle ID="font1" FONTFAMILY="cambria" FONTSIZE="12.000" FONTSTYLE="bold"/>
<TextStyle ID="font2" FONTFAMILY="cambria" FONTSIZE="7.920" FONTSTYLE="sup"/>
<TextStyle ID="font3" FONTFAMILY="cambria" FONTSIZE="12.000" FONTSTYLE="it"/>
</STYLES>
<LAYOUT>
<TextBlock ID="p1_b1" HPOS="83.6703" VPOS="75.8759" HEIGHT="10.6680" WIDTH="445.700">
<TextLine WIDTH="445.700" HEIGHT="10.6680" ID="p1_t1" HPOS="83.6703" VPOS="75.8759">
<String ID="p1_w1" CONTENT="Hie" HPOS="83.6703" VPOS="75.8759" STYLEREFS="font0"/>
<String ID="p1_w2" CONTENT="org" HPOS="154.915" VPOS="75.8759" STYLEREFS="font0"/>
<String ID="p1_w3" CONTENT="of" HPOS="228.005" VPOS="75.8759" STYLEREFS="font0"/>
<String ID="p1_w4" CONTENT="the" HPOS="241.393" VPOS="75.8759" STYLEREFS="font0"/>
<String ID="p1_w5" CONTENT="Human" HPOS="261.948" VPOS="75.8759" STYLEREFS="font1"/>
<String ID="p1_w6" CONTENT="cell" HPOS="303.263" VPOS="75.8759" STYLEREFS="font0"/>
<String ID="p1_w8" CONTENT="a" HPOS="354.900" VPOS="75.8759" STYLEREFS="font0"/>
<String ID="p1_w9" CONTENT="CANCER" HPOS="363.965" VPOS="75.8759" STYLEREFS="font3"/>
</TextLine>
</TextBlock>
</LAYOUT>
</ALTO>
into
<b>Human</b>
<it>CANCER</it>
so that should show how to replace the elements that reference a style.
I guess you will want to add further templates like
<xsl:template mode="fix-html" match="it">
<i>
<xsl:apply-templates mode="#current"/>
</i>
</xsl:template>
to transform/fix all those styles you have to corresponding, existing HTML elements.

Related

How to handle JSON input with Saxon XSLT

Recent Saxon releases contain a command line argument "-json:myfile.json" to input a JSON file.
But how do I implement the XSLT to parse this JSON? I did not find any doc which handles this directly (without making use of "json-to-xml" or similar).
I only found this: how to convert json to xml with saxonjs?
But this does not help me, because my json starts with an array:
[
{
"eid": "2122.5",
"ecat": "show",
"day": "1629410400",
"spcat": "Bühne",
"time": "19:30",
"text": "Welle",
"remarks": "",
"location": ""
},
{
"eid": "2122.6",
"ecat": "show",
"day": "1629496800",
"spcat": "Bühne",
"time": "19:30",
"text": "Welle",
"remarks": "",
"location": ""
}
]
By writing an intermediate XSLT using the function "json-to-xml", I can convert this JSON to xml that looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<array xmlns="http://www.w3.org/2005/xpath-functions">
<map>
<string key="eid">2122.5</string>
<string key="ecat">show</string>
<string key="day">1629410400</string>
<string key="spcat">Bühne</string>
<string key="time">19:30</string>
<string key="text">Welle</string>
<string key="remarks"/>
<string key="location"/>
</map>
<map>
<string key="eid">2122.6</string>
<string key="ecat">show</string>
<string key="day">1629496800</string>
<string key="spcat">Bühne</string>
<string key="time">19:30</string>
<string key="text">Welle</string>
<string key="remarks"/>
<string key="location"/>
</map>
</array>
How can I create a template that matches the root item, and how can I call "apply-templates" to trigger another template that handles the items?
The JSON you have shown is an array so it will be mapped to the XPath/XSLT XDM type array(*), or, in your case, array(map(xs:string, xs:string)). To match on that use e.g. <xsl:template match=".[. instance of array(*)]">..</xsl:template> or e.g. <xsl:template match=".[. instance of array(map(xs:string, xs:string))]">..</xsl:template>.
More complete example would be online at the fiddle, doing:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="3.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:map="http://www.w3.org/2005/xpath-functions/map"
exclude-result-prefixes="#all"
expand-text="yes">
<xsl:output method="xml" indent="yes"/>
<xsl:template match=".[. instance of array(map(xs:string, xs:string))]">
<items>
<xsl:apply-templates select="?*"/>
</items>
</xsl:template>
<xsl:template match=".[. instance of map(xs:string, xs:string)]">
<xsl:variable name="map" select="."/>
<item>
<xsl:iterate select="map:keys(.)">
<value key="{.}">{$map(.)}</value>
</xsl:iterate>
</item>
</xsl:template>
</xsl:stylesheet>
As for grouping:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="3.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:map="http://www.w3.org/2005/xpath-functions/map"
exclude-result-prefixes="#all"
expand-text="yes">
<xsl:output method="xml" indent="yes"/>
<xsl:template match=".[. instance of array(map(xs:string, xs:string))]">
<items>
<xsl:for-each-group select="?*" group-by="?text">
<group name="{current-grouping-key()}">
<xsl:apply-templates select="current-group()"/>
</group>
</xsl:for-each-group>
</items>
</xsl:template>
<xsl:template match=".[. instance of map(xs:string, xs:string)]">
<xsl:variable name="map" select="."/>
<item>
<xsl:iterate select="map:keys(.)[not(. = current-grouping-key())]">
<value key="{.}">{$map(.)}</value>
</xsl:iterate>
</item>
</xsl:template>
</xsl:stylesheet>

Best way to use for-each inside if in XSLT

I have the below XML data as input to my XSLT:
<?xml version="1.0" encoding="UTF-8"?>
<Application>
<Data>
<Data1>
<name>Michale</name>
<age>65</age>
<Info>
<Alias name="M">
<Contactmail>abc#gmail.com</Contactmail>
<ContactPh>8988900009</ContactPh>
</Alias>
<Alias name="Q">
<Contactmail>abc#gmail.com</Contactmail>
<ContactPh>8988900009</ContactPh>
</Alias>
</Info>
</Data1>
<Data1>
<name>Albert</name>
<age>69</age>
<Info>
<Alias name="A">
<Contactmail>xyz#gmail.com</Contactmail>
<ContactPh>89889908709</ContactPh>
</Alias>
<Alias name="P">
<Contactmail>pqr#gmail.com</Contactmail>
<ContactPh>8988988779</ContactPh>
</Alias>
</Info>
</Data1>
</Data>
</Application>
And I want to pass the Data1 block whose Alias name matches with "M", i.e.:
<Application>
<Data>
<Data1>
<name>Michale</name>
<age>65</age>
<Info>
<Alias name=M>
<Contactmail>abc#gmail.com</Contactmail>
<ContactPh>8988900009</ContactPh>
</Alias>
<Alias name=Q>
<Contactmail>abc#gmail.com</Contactmail>
<ContactPh>8988900009</ContactPh>
</Alias>
</Info>
</Data1>
</Data>
</Application>
I am stuck as to how to access an loop(ie Alias) inside a test condition?
Is there any better way to do this xslt?
<xsl:for-each select="./*[local-name() = 'Application']/*[local-name() = 'Data']">
<xsl:if test="">
....
</xsl:if>
</xsl:for-each>
The following template will do the job. The explanations are in the code.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:strip-space elements="*" /> <!-- Removes unnecessary space between elements -->
<!-- identity template --> <!-- Copies all nodes not matched by other templates -->
<xsl:template match="node()|#*">
<xsl:copy>
<xsl:apply-templates select="node()|#*" />
</xsl:copy>
</xsl:template>
<xsl:template match="Data1[Info/Alias/#name != 'M']" /> <!-- Ignores all Data1 elements which don't have an #name='M' attribute child -->
<xsl:template match="Data1[Info/Alias/#name = 'M']"> <!-- Matches all Data1 elements which have the desired child attribute -->
<xsl:copy>
<xsl:apply-templates select="node()|#*" />
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Its output is:
<?xml version="1.0"?>
<Application>
<Data>
<Data1>
<name>Michale</name>
<age>65</age>
<Info>
<Alias name="M">
<Contactmail>abc#gmail.com</Contactmail>
<ContactPh>8988900009</ContactPh>
</Alias>
<Alias name="Q">
<Contactmail>abc#gmail.com</Contactmail>
<ContactPh>8988900009</ContactPh>
</Alias>
</Info>
</Data1>
</Data>
</Application>
<xsl:strip-space elements="*"/>
<xsl:template match="#*|node()">
<xsl:copy>
<xsl:apply-templates select="#*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="Application">
<xsl:copy>
<xsl:for-each select="Data/Data1">
<xsl:if test="Info/Alias[#name='M']">
<Data>
<Data1>
<xsl:apply-templates/>
</Data1>
</Data>
</xsl:if>
</xsl:for-each>
</xsl:copy>
</xsl:template>
You may also do like this

XSL group by node value

I have a case of XSL key grouping. The goal is to replace a value based on an ID match.
Input:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<message-in>
<actions>
<stop>
<action id="33632">
<text>DefaultComment</text>
<planning-status>finished</planning-status>
<realised-times>
<starttime>2017-03-13T12:43:54</starttime>
<finishtime>2017-03-13T13:15:21</finishtime>
</realised-times>
</action>
</stop>
<stop>
<action id="33635">
<planning-status>started</planning-status>
<realised-times>
<starttime>2017-03-13T13:15:21</starttime>
</realised-times>
</action>
</stop>
</actions>
</message-in>
<output_getquerydata>
<queries>
<query name="fat">
<parameters>
<parameter name="id">33632</parameter>
</parameters>
<queryErrors/>
<queryResults>
<record id="1">
<column name="interfaceAction_externalId">33633OREA</column>
</record>
</queryResults>
</query>
</queries>
</output_getquerydata>
<output_getquerydata>
<queries>
<query name="fat">
<parameters>
<parameter name="id">33635</parameter>
</parameters>
<queryErrors/>
<queryResults>
<record id="1">
<column name="interfaceAction_externalId">536313OREA</column>
</record>
</queryResults>
</query>
</queries>
</output_getquerydata>
</root>
XSL:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" omit-xml-declaration="no" encoding="utf-8"/>
<xsl:strip-space elements="*"/>
<xsl:key name="actionKey" match="stop" use="action/#id"/>
<xsl:template match="#* | node()">
<xsl:copy>
<xsl:apply-templates select="#* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="/">
<root>
<xsl:copy-of select="//message-in"/>
</root>
</xsl:template>
<xsl:template match="action/#id">
<xsl:attribute name="id"><xsl:value-of select="substring-before(//output_getquerydata/queries/query/parameters/parameter[key('actionKey', #id)]/queryResults/record/column[#name='interfaceAction_externalId'],'OREA')"/></xsl:attribute>
</xsl:template>
</xsl:stylesheet>
I have multiple "action" nodes that have matching "query" nodes.
The goal is that for every action ID we need to replace the ID value from the "action" tag with the corresponding "interfaceAction_externalId" value.
So for action ID 33632 we'll copy and replace with the value of "33633" (because we have a match in parameneter/name/#id 33632 = action/#id ).
The copy works well I get all the information I need, but it seems that action/#id doesn't get replaced.
I thought that I'll use a key to save the values of action/#id then use that in the template match to replace with the value from interfaceAction_externalId, but it doesn't work and I'm not sure what I'm doing wrong.
Thanks for your help!
The whole approach only makes sense if you use <xsl:apply-templates select="//message-in"/> instead of <xsl:copy-of select="//message-in"/>.
As for using a key, I think you want
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" omit-xml-declaration="no" encoding="utf-8"/>
<xsl:strip-space elements="*"/>
<xsl:key name="ref-query"
match="output_getquerydata/queries/query/queryResults/record/column[#name='interfaceAction_externalId']"
use="ancestor::query/parameters/parameter[#name = 'id']"/>
<xsl:template match="#* | node()">
<xsl:copy>
<xsl:apply-templates select="#* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="/">
<root>
<xsl:apply-templates select="//message-in"/>
</root>
</xsl:template>
<xsl:template match="action/#id">
<xsl:attribute name="id"><xsl:value-of select="substring-before(key('ref-query', .),'OREA')"/></xsl:attribute>
</xsl:template>
</xsl:stylesheet>

xsl to remove specific attribute and add it as a child node instead

I have the following xml:
<Envelope>
<ABC>
<Hierarchy>
<Family>
<History> ... </History>
<Plan>
<Mom Name="Parent1">
<Child Name = "Child11">
<GrandChild Name="GC111" Label="" Sequence = "1">
<Attributes>... </Attributes>
</GrandChild>
</Child>
</Mom>
<Child Name = "ChildIndependent1">
<GrandChild Name="GCIndep12" Label="<Requested><Item1>68</Item1><Item2>69</Item2&g t;</Requested>" Sequence = "2" >
<Attributes>... </Attributes>
</GrandChild> </Child>
</Plan> </Family>
</Hierarchy> </ABC>
</Envelope>
Here is my current xsl i have on the xml to create dummy mom tags around independent child tags. It also converts the & lt; and & gt; to < and >
<xsl:stylesheet version="2.0" >
<xsl:output method="xml" indent="yes" use-character-maps="angle-brackets"/>
<xsl:character-map name="angle-brackets">
<xsl:output-character character="<" string="<"/>
<xsl:output-character character=">" string=">"/>
</xsl:character-map>
<xsl:template match="node()|#*">
<xsl:copy><xsl:apply-templates select="node()|#*"/></xsl:copy>
</xsl:template>
<xsl:template match="//ABC/Hierarchy/Family">
<xsl:element name="Plan">
<xsl:for-each select="//ABC/Hierarchy/Family/Plan/*">
<xsl:if test="self::Mom">
<xsl:copy-of select="."/>
</xsl:if>
<xsl:if test="self::Child">
<xsl:element name="Mom">
<xsl:attribute name="Name">dummy</xsl:attribute>
<xsl:copy-of select="."/>
</xsl:element>
</xsl:if>
</xsl:for-each>
</xsl:element>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
I need to modify the above xsl to create the LabelRequested tag with the content of the label attribute as a child to the GrandChild and remove the Label attribute itself as below above xsl already converts the & lt; and & gt; to < and >.
<Child Name = "ChildIndependent1">
<GrandChild Name="GCIndep12" Sequence = "2" >
<LabelRequested>
<Requested><Item1>68</Item1><Item2>69</Item2> </Requested>
</LabelRequested>
<Attributes>... </Attributes>
</GrandChild>
Any idea how I could change the above xsl to do this?
To minimize the example to the problem at hand, consider the following stylesheet:
XSLT 2.0
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:strip-space elements="*"/>
<!-- identity transform -->
<xsl:template match="#*|node()">
<xsl:copy>
<xsl:apply-templates select="#*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="GrandChild">
<xsl:copy>
<xsl:apply-templates select="#* except #Label"/>
<LabelRequested>
<xsl:value-of select="#Label" disable-output-escaping="yes"/>
</LabelRequested>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Applied to your input example, the result will be:
<?xml version="1.0" encoding="UTF-8"?>
<Envelope>
<ABC>
<Hierarchy>
<Family>
<History> ... </History>
<Plan>
<Mom Name="Parent1">
<Child Name="Child11">
<GrandChild Name="GC111" Sequence="1">
<LabelRequested/>
<Attributes>... </Attributes>
</GrandChild>
</Child>
</Mom>
<Child Name="ChildIndependent1">
<GrandChild Name="GCIndep12" Sequence="2">
<LabelRequested><Requested><Item1>68</Item1><Item2>69</Item2></Requested></LabelRequested>
<Attributes>... </Attributes>
</GrandChild>
</Child>
</Plan>
</Family>
</Hierarchy>
</ABC>
</Envelope>
Note that this assumes your processor supports disable-output-escaping and that the processing chain allows it to execute it. Otherwise you would have to use either XSLT 3.0 or an extension function to parse the markup contained in the Label attribute.

Facing Issue in XSLT Format

I am looking my xslt in below format:
<xml>
<apis>
<name>API Name</name>
<comment> Comment</comment>
<version>12</version>
</apis>
</xml>
XSLT Code:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:L7j="http://ns.l7tech.com/2012/08/jdbc-query-result" version="1.0">
<xsl:output method="xml" indent="yes" />
<xsl:template match="/">
<xml>
<xsl:apply-templates select="//L7j:col" />
</xml>
</xsl:template>
<xsl:template match="//L7j:col">
<api>
<xsl:element name="{#name}">
<xsl:value-of select="." /></xsl:element>
</api>
</xsl:template>
</xsl:stylesheet>
Input XML:
<?xml version="1.0" encoding="UTF-8"?>
<L7j:jdbcQueryResult xmlns:L7j="http://ns.l7tech.com/2012/08/jdbc-query-result">
<L7j:row>
<L7j:col name="name" type="java.lang.String">Policy for service #0b8bab6913cc588557b6973e94d1bfdd, WSTrustSoapService</L7j:col>
<L7j:col name="comment">
<![CDATA[NULL]]>
</L7j:col>
<L7j:col name="version" type="java.lang.Integer">18</L7j:col>
</L7j:row>
<L7j:row>
<L7j:col name="name" type="java.lang.String">Policy for service #0b8bab6913cc588557b6973e94d5893d, UUPRStub</L7j:col>
<L7j:col name="comment">
<![CDATA[NULL]]>
</L7j:col>
<L7j:col name="version" type="java.lang.Integer">16</L7j:col>
</L7j:row>
</L7j:jdbcQueryResult>
If I understand correctly, you want to do:
XSLT 1.0
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:L7j="http://ns.l7tech.com/2012/08/jdbc-query-result"
exclude-result-prefixes="L7j">
<xsl:output method="xml" indent="yes" />
<xsl:strip-space elements="*"/>
<xsl:template match="/L7j:jdbcQueryResult">
<xml>
<xsl:apply-templates/>
</xml>
</xsl:template>
<xsl:template match="L7j:row">
<apis>
<xsl:apply-templates/>
</apis>
</xsl:template>
<xsl:template match="L7j:col">
<xsl:element name="{#name}">
<xsl:value-of select="." />
</xsl:element>
</xsl:template>
</xsl:stylesheet>