Project

Profile

Help

Bug #5747 » Example.xslt

Test script - Herbert Brückner, 2022-11-27 13:39

 
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:sql="http://saxon.sf.net/sql"
xmlns:map="http://www.w3.org/2005/xpath-functions/map"
xmlns:saxon="http://saxon.sf.net/"
extension-element-prefixes="saxon"
version="3.1">

<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:variable name="connection" select="sql:connect(map{ 'database':'jdbc:oracle:thin:my_DB_URL',
'user':'my_user', 'password':'my_pwd', 'autoCommit':true()})"/>


<xsl:template match="/">
<!-- Example 1:
Expect: no row is updated
Observed: all rows were updated
-->
<xsl:sequence select="sql:update($connection, 'SQL_TEST', '0 = 1 ', map{ 'VALUE': 'not wanted'})"/>
<!-- Example 2:
Expect: first row is updated
Observed: all rows were updated
-->
<xsl:sequence select="sql:update($connection, 'SQL_TEST', 'KEY = ''key 1'' ', map{ 'VALUE': 'now wanted'})"/>
</xsl:template>

</xsl:stylesheet>
(1-1/3)