Anonymous avatar Anonymous committed d8bb2aa

xslt version and test

Comments (0)

Files changed (2)

config_reader.xsl

+<xsl:stylesheet
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  version="1.0">
+
+  <xsl:param name="database_config_file" select="'./testdatabases.xml'"/>
+  <xsl:param name="database_name" select="'default-ro'"/>
+
+  <xsl:variable name="databases" select="document($database_config_file)"/> 
+  <xsl:variable name="db" select="$databases/databases/database[@name=$database_name]"/> 
+
+  <xsl:param name="sqlConnect.database"> 
+    <xsl:text>jdbc:mysql://</xsl:text> 
+    <xsl:value-of select="$db/host"/> 
+    <xsl:text>:</xsl:text> 
+    <xsl:value-of select="$db/port"/> 
+    <xsl:text>/</xsl:text> 
+    <xsl:value-of select="$db/name"/> 
+  </xsl:param> 
+  <xsl:param name="sqlConnect.user" select="$db/user"/> 
+  <xsl:param name="sqlConnect.password" select="$db/password"/> 
+  <xsl:param name="sqlConnect.driver" select="'com.mysql.jdbc.Driver'"/> 
+
+  <xsl:output omit-xml-declaration="yes"/>
+
+  <!-- xsl:template match="/">
+<test>
+  <xsl:copy-of select="$databases"/>
+  <xsl:copy-of select="$db"/>
+A <xsl:value-of select="$sqlConnect.database"/>
+B <xsl:value-of select="$sqlConnect.user"/>
+C <xsl:value-of select="$sqlConnect.password"/>
+D <xsl:value-of select="$sqlConnect.driver"/>
+    <xsl:if test="not( 'a' = 'a')"> 
+        <xsl:message terminates="yes">XSLT test failed</xsl:message>
+    </xsl:if>
+</test>
+
+  </xsl:template -->
+</xsl:stylesheet>
+<xsl:stylesheet
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  version="1.0">
+
+  <xsl:include href="./config_reader.xsl"/>
+
+  <xsl:output omit-xml-declaration="yes"/>
+
+  <xsl:template match="/">
+    <xsl:if test="not($sqlConnect.database = 'jdbc:mysql://db.example.org:3333/name1ro' and 
+                      $sqlConnect.user = 'user1ro' and
+                      $sqlConnect.password = 'pass1ro' and
+                      $sqlConnect.driver = 'com.mysql.jdbc.Driver') ">
+        <xsl:text>XSLT test failed</xsl:text>
+    </xsl:if>
+  </xsl:template>
+</xsl:stylesheet>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.