ilene 2003/02/27 16:25:19
Modified: java/samples/extensions/sql/streamable cachedNodes.xsl
pivot.xsl
java/xdocs/sources/xalan samples.xml
java/samples/CompiledApplet menu.html README.applet
java/samples/extensions/sql/basic-connection dbinfo.xml
dbtest.xsl
Log:
More sample and documentation updates from Christine Li ([EMAIL PROTECTED]).
Revision Changes Path
1.4 +122 -61
xml-xalan/java/samples/extensions/sql/streamable/cachedNodes.xsl
Index: cachedNodes.xsl
===================================================================
RCS file:
/home/cvs/xml-xalan/java/samples/extensions/sql/streamable/cachedNodes.xsl,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- cachedNodes.xsl 25 Jan 2002 19:41:32 -0000 1.3
+++ cachedNodes.xsl 28 Feb 2003 00:25:11 -0000 1.4
@@ -1,62 +1,123 @@
-<?xml version="1.0"?>
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- version="1.0"
- xmlns:sql="org.apache.xalan.lib.sql.XConnection"
- extension-element-prefixes="sql">
-
-<xsl:output method="html" indent="yes"/>
-
-<xsl:param name="driver" select="'com.lutris.instantdb.jdbc.idbDriver'"/>
-<xsl:param name="datasource" select="'jdbc:idb:../../instantdb/sample.prp'"/>
-<xsl:param name="query" select="'SELECT * FROM import1'"/>
-
-<xsl:template match="/">
- <xsl:variable name="db" select="sql:new()"/>
-
- <!-- Connect to the database with minimal error detection -->
- <xsl:if test="not(sql:connect($db, $driver, $datasource))" >
- <xsl:message>Error Connecting to the Database</xsl:message>
- <xsl:copy-of select="sql:getError($db)/ext-error" />
- </xsl:if>
-
-
- <HTML>
- <HEAD>
- <TITLE>List of products</TITLE>
- </HEAD>
- <BODY>
- <TABLE border="1">
- <xsl:value-of select="sql:disableStreamingMode($db)" />
- <xsl:variable name="table" select='sql:query($db, $query)'/>
-
- <!--
- Let's include Error Checking, the error is actually stored
- in the connection since $table will be either data or null
- -->
-
- <xsl:if test="not($table)" >
- <xsl:message>Error in Query</xsl:message>
- <xsl:copy-of select="sql:getError($db)/ext-error" />
- </xsl:if>
-
- <TR>
- <xsl:for-each select="$table/row-set/column-header">
- <TH><xsl:value-of select="@column-label"/></TH>
- </xsl:for-each>
- </TR>
- <xsl:apply-templates select="$table/row-set/row"/>
- </TABLE>
- </BODY>
- </HTML>
- <xsl:value-of select="sql:close($db)"/>
-</xsl:template>
-
-<xsl:template match="row">
- <TR><xsl:apply-templates select="col"/></TR>
-</xsl:template>
-
-<xsl:template match="col">
- <TD><xsl:value-of select="text()"/></TD>
-</xsl:template>
-
+<?xml version="1.0"?>
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+
+ version="1.0"
+
+ xmlns:sql="org.apache.xalan.lib.sql.XConnection"
+
+ extension-element-prefixes="sql">
+
+
+
+<xsl:output method="html" indent="yes"/>
+
+
+
+<xsl:param name="driver" select="'com.lutris.instantdb.jdbc.idbDriver'"/>
+
+<xsl:param name="datasource" select="'jdbc:idb:../../instantdb/sample.prp'"/>
+
+<xsl:param name="query" select="'SELECT * FROM import1'"/>
+
+
+
+<xsl:template match="/">
+
+ <xsl:variable name="db" select="sql:new()"/>
+
+
+
+ <!-- Connect to the database with minimal error detection -->
+
+ <xsl:if test="not(sql:connect($db, $driver, $datasource))" >
+
+ <xsl:message>Error Connecting to the Database</xsl:message>
+
+ <xsl:copy-of select="sql:getError($db)/ext-error" />
+
+ </xsl:if>
+
+
+
+
+
+ <HTML>
+
+ <HEAD>
+
+ <TITLE>List of products</TITLE>
+
+ </HEAD>
+
+ <BODY>
+
+ <TABLE border="1">
+
+ <xsl:value-of select="sql:disableStreamingMode($db)" />
+
+ <xsl:variable name="table" select='sql:query($db, $query)'/>
+
+
+
+ <!--
+
+ Let's include Error Checking, the error is actually stored
+
+ in the connection since $table will be either data or null
+
+ -->
+
+
+
+ <xsl:if test="not($table)" >
+
+ <xsl:message>Error in Query</xsl:message>
+
+ <xsl:copy-of select="sql:getError($db)/ext-error" />
+
+ </xsl:if>
+
+
+
+ <TR>
+
+ <xsl:for-each select="$table/row-set/metadata/column-header">
+
+ <TH><xsl:value-of select="@column-label"/></TH>
+
+ </xsl:for-each>
+
+ </TR>
+
+ <xsl:apply-templates select="$table/sql/row-set/row"/>
+
+ </TABLE>
+
+ </BODY>
+
+ </HTML>
+
+ <xsl:value-of select="sql:close($db)"/>
+
+</xsl:template>
+
+
+
+<xsl:template match="row">
+
+ <TR><xsl:apply-templates select="col"/></TR>
+
+</xsl:template>
+
+
+
+<xsl:template match="col">
+
+ <TD><xsl:value-of select="text()"/></TD>
+
+</xsl:template>
+
+
+
</xsl:stylesheet>
1.4 +164 -82
xml-xalan/java/samples/extensions/sql/streamable/pivot.xsl
Index: pivot.xsl
===================================================================
RCS file:
/home/cvs/xml-xalan/java/samples/extensions/sql/streamable/pivot.xsl,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- pivot.xsl 25 Jan 2002 19:41:32 -0000 1.3
+++ pivot.xsl 28 Feb 2003 00:25:11 -0000 1.4
@@ -1,83 +1,165 @@
-<?xml version="1.0"?>
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- version="1.0"
- xmlns:sql="org.apache.xalan.lib.sql.XConnection"
- extension-element-prefixes="sql">
-
-<xsl:output method="html" indent="yes"/>
-
-<xsl:param name="driver" select="'com.lutris.instantdb.jdbc.idbDriver'"/>
-<xsl:param name="datasource" select="'jdbc:idb:../../instantdb/sample.prp'"/>
-<xsl:param name="query" select="'SELECT * FROM import1'"/>
-
-<xsl:template match="/">
- <xsl:variable name="db" select="sql:new()"/>
-
- <!-- Connect to the database with minimal error detection -->
- <xsl:if test="not(sql:connect($db, $driver, $datasource))" >
- <xsl:message>Error Connecting to the Database</xsl:message>
- <xsl:copy-of select="sql:getError($db)/ext-error" />
- </xsl:if>
-
-
- <HTML>
- <HEAD>
- <TITLE>List of products</TITLE>
- </HEAD>
- <BODY>
-
- <!-- Turn off Streaming -->
- <xsl:value-of select="sql:disableStreamingMode()" />
-
- <xsl:variable name="table" select='sql:query($db, $query)'/>
-
- <!--
- Let's include Error Checking, the error is actually stored
- in the connection since $table will be either data or null
- -->
-
- <xsl:if test="not($table)" >
- <xsl:message>Error in Query</xsl:message>
- <xsl:copy-of select="sql:getError($db)/ext-error" />
- </xsl:if>
-
-
-
- <TABLE border="1">
- <TR>
- <xsl:for-each select="$table/row-set/column-header">
- <TH><xsl:value-of select="@column-label"/></TH>
- </xsl:for-each>
- </TR>
- <xsl:apply-templates select="$table/row-set/row"/>
- </TABLE>
-
- <TABLE border="1">
-
- <xsl:for-each select="$table/row-set/column-header">
- <xsl:variable name="column" select="@column-label" />
-
- <TR>
- <TD><TH><xsl:value-of select="$column"/></TH></TD>
- <xsl:apply-templates
- select="$table/row-set/row/[EMAIL PROTECTED]" />
- </TR>
- </xsl:for-each>
-
- </TABLE>
-
-
- </BODY>
- </HTML>
- <xsl:value-of select="sql:close($db)"/>
-</xsl:template>
-
-<xsl:template match="row">
- <TR><xsl:apply-templates select="col"/></TR>
-</xsl:template>
-
-<xsl:template match="col">
- <TD><xsl:value-of select="text()"/></TD>
-</xsl:template>
-
+<?xml version="1.0"?>
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+
+ version="1.0"
+
+ xmlns:sql="org.apache.xalan.lib.sql.XConnection"
+
+ extension-element-prefixes="sql">
+
+
+
+<xsl:output method="html" indent="yes"/>
+
+
+
+<xsl:param name="driver" select="'com.lutris.instantdb.jdbc.idbDriver'"/>
+
+<xsl:param name="datasource" select="'jdbc:idb:../../instantdb/sample.prp'"/>
+
+<xsl:param name="query" select="'SELECT * FROM import1'"/>
+
+
+
+<xsl:template match="/">
+
+ <xsl:variable name="db" select="sql:new()"/>
+
+
+
+ <!-- Connect to the database with minimal error detection -->
+
+ <xsl:if test="not(sql:connect($db, $driver, $datasource))" >
+
+ <xsl:message>Error Connecting to the Database</xsl:message>
+
+ <xsl:copy-of select="sql:getError($db)/ext-error" />
+
+ </xsl:if>
+
+
+
+
+
+ <HTML>
+
+ <HEAD>
+
+ <TITLE>List of products</TITLE>
+
+ </HEAD>
+
+ <BODY>
+
+
+
+ <!-- Turn off Streaming -->
+
+ <xsl:value-of select="sql:disableStreamingMode()" />
+
+
+
+ <xsl:variable name="table" select='sql:query($db, $query)'/>
+
+
+
+ <!--
+
+ Let's include Error Checking, the error is actually stored
+
+ in the connection since $table will be either data or null
+
+ -->
+
+
+
+ <xsl:if test="not($table)" >
+
+ <xsl:message>Error in Query</xsl:message>
+
+ <xsl:copy-of select="sql:getError($db)/ext-error" />
+
+ </xsl:if>
+
+
+
+
+
+
+
+ <TABLE border="1">
+
+ <TR>
+
+ <xsl:for-each select="$table/sql/metadata/column-header">
+
+ <TH><xsl:value-of select="@column-label"/></TH>
+
+ </xsl:for-each>
+
+ </TR>
+
+ <xsl:apply-templates select="$table/sql/row-set/row"/>
+
+ </TABLE>
+
+
+
+ <TABLE border="1">
+
+
+
+ <xsl:for-each select="$table/row-set/column-header">
+
+ <xsl:variable name="column" select="@column-label" />
+
+
+
+ <TR>
+
+ <TD><TH><xsl:value-of select="$column"/></TH></TD>
+
+ <xsl:apply-templates
+
+ select="$table/row-set/row/[EMAIL PROTECTED]" />
+
+ </TR>
+
+ </xsl:for-each>
+
+
+
+ </TABLE>
+
+
+
+
+
+ </BODY>
+
+ </HTML>
+
+ <xsl:value-of select="sql:close($db)"/>
+
+</xsl:template>
+
+
+
+<xsl:template match="row">
+
+ <TR><xsl:apply-templates select="col"/></TR>
+
+</xsl:template>
+
+
+
+<xsl:template match="col">
+
+ <TD><xsl:value-of select="text()"/></TD>
+
+</xsl:template>
+
+
+
</xsl:stylesheet>
1.53 +15 -22 xml-xalan/java/xdocs/sources/xalan/samples.xml
Index: samples.xml
===================================================================
RCS file: /home/cvs/xml-xalan/java/xdocs/sources/xalan/samples.xml,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -r1.52 -r1.53
--- samples.xml 21 Feb 2003 20:10:08 -0000 1.52
+++ samples.xml 28 Feb 2003 00:25:13 -0000 1.53
@@ -301,33 +301,25 @@
are provided for testing.</note>
<p>To run the servlet: set system property server.root=server root. Set
up an HTML page to call
servlet.ApplyXSLT with arguments as illustrated below.</p>
- <p>The files foo.xml and foo.xsl used in the following example are
created by the user. Good
- examples for these files are birds.xml/birds.xsl and foo.xml/foo.xsl
under the SimpleTransform
- sample. If you create these files yourself, be careful that the output
method should
+ <p>The files catalog.xml, booklist1.xsl and booklist2.xsl are used in
the following example.
+ In the deploy descriptor, booklist1.xsl is set as the default xsl file.
If you create these files yourself, be careful that the output method should
be set to "xml" in the stylesheet.</p>
<p>Examples:</p>
<gloss>
-<label>http://localhost/servlethome/servlet.ApplyXSLT?URL=/foo.xml&xslURL=
-/foo.xsl</label>
-<item>...applies the foo.xsl stylesheet to the foo.xml data. Both files
are<br/>
+<label>http://localhost:port/xalanservlet/ApplyXSLT?URL=/xalanservlet/catalog.xml&xslURL=
+/xalanservlet/booklist2.xsl</label>
+<item>...applies the booklist2.xsl stylesheet to the catalog.xml data. Both
files are<br/>
served from the Web server's HTTP document root.<br/><br/></item>
-<label>http://localhost/servlethome/servlet.ApplyXSLT?URL=/foo.xml&xslURL=
-/foo.xsl&debug=true</label>
+<label>http://localhost:port/xalanservlet/ApplyXSLT?URL=/xalanservlet/catalog.xml&xslURL=
+/xalanservlet/booklist2.xsl&debug=true</label>
<item>...ensures that XML and XSL processor messages are returned in the
event of problems
-applying foo.xsl to foo.xml<br/><br/></item>
-<label>http://localhost/servlethome/servlet.ApplyXSLT/foo.xml?xslURL=/foo.xsl</label>
-<item>...applies the foo.xsl stylesheet to the foo.xml data, just like the
first example.
+applying booklist2.xsl to catalog.xml<br/><br/></item>
+<label>http://localhost:port/xalanservlet/ApplyXSLT/xalanservlet/catalog.xml?xslURL=/xalanservlet/booklist2.xsl</label>
+<item>...applies the booklist2.xsl stylesheet to the catalog.xml data, just
like the first example.
This is an alternative way of specifying the XML XSLTInputSource by
utilizing the HTTP request's path
information.<br/><br/></item>
-<label>http://localhost/servlethome/servlet.ApplyXSLT/foo.xml</label>
-<item>...examines foo.xml for an associated XSL stylesheet (a stylesheet
Processing Instruction). If multiple XSLs are associated with the data, the
stylesheet whose media attribute maps to your browser type will be chosen. If
no mapping is successful, the primary associated stylesheet is
used.<br/><br/></item>
-<label>http://localhost/servlet/foo.xml</label>
-<item>...provides the same function as the previous example, but this
example assumes
-that /servlet/foo.xml has been mapped to be executed by this servlet. The
servlet engine may be configured
-to map all or some *.xml files to this servlet through the use of servlet
aliases or filters.<br/><br/></item>
-<label>http://localhost/servlet/foo.xml?catalog=http://www.xml.org/dtds/oag.xml</label>
-<item>...supplements any servlet-configured XCatalog
-with a catalog of supply chain DTDs residing at the XML.ORG DTD
repository.</item>
+<label>http://localhost:port/xalanservlet/ApplyXSLT/xalanservlet/catalog.xml</label>
+<item>...examines catalog.xml for an associated XSL stylesheet booklist1.xsl
(a stylesheet Processing Instruction). If multiple XSLs are associated with the
data, the stylesheet whose media attribute maps to your browser type will be
chosen. If no mapping is successful, the primary associated stylesheet is
used.<br/><br/></item>
</gloss>
</s3>
</s2><anchor name="extensions"/>
@@ -350,7 +342,8 @@
<p>To run these examples, you must place bsf.jar (distributed with
&xslt4j;), and js.jar
(version 1.5, available from
<jump
href="http://www.mozilla.org/rhino">http://www.mozilla.org/rhino</jump>) on the
classpath.
- You do not need js.jar on the classpath for the samples that use Java
extensions. </p>
+ You do not need js.jar on the classpath for the samples that use Java
extensions. <link idref="faq.html">
+ Problems related to JDK 1.4</link></p>
<p>Use java.org.apache.xalan.xslt.Process, the &xslt4j; command-line
utility, to run most of these samples from
the <link idref="commandline">command line</link>. The command line
must include an -in flag with the
XML source and an -xsl flag with the XSL stylesheet. If you want the
output to be written to a file, rather
@@ -416,7 +409,7 @@
<li>Modify the SQL query to your own needs. The SQL query is
defined in a parameter like
<code><xsl:param name="query" select="'SELECT * FROM
import1'"/></code>.</li>
<li>Modify the JDBC driver name and the database url. They are
specified in the stylesheets as parameters for some
- examples. For other examples the parameters are defined in the
dbinfo.xml file.</li>
+ examples. For other examples the parameters are defined in the
basic-connection/dbinfo.xml and basic-connection/dbtest.xsl.</li>
</ul>
</li>
<li>Add the JDBC driver jar to the system class path.</li>
1.2 +5 -5 xml-xalan/java/samples/CompiledApplet/menu.html
Index: menu.html
===================================================================
RCS file: /home/cvs/xml-xalan/java/samples/CompiledApplet/menu.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- menu.html 17 May 2001 15:36:30 -0000 1.1
+++ menu.html 28 Feb 2003 00:25:14 -0000 1.2
@@ -12,15 +12,15 @@
function run_transform(form) {
/* Get the input document and translet class name from input form */
- var translet = form.translet;
- var document = form.document;
+ var translet = form.translet.value;
+ var doc = form.doc.value;
/* Get the frame to output to */
var output_frame = parent.frames.demo_output.document;
/* Display the output in this frame */
output_frame.clear();
- output_frame.writeln(document.TransformApplet.transform(translet,
document));
+ output_frame.writeln(document.TransformApplet.transform(translet,
doc));
output_frame.close();
return(true);
}
@@ -31,7 +31,7 @@
<p>Select translet:</p>
<p><input name="translet" width="64"></p>
<p>Select XML source document:</p>
- <p><input name="document" width="64"></p>
+ <p><input name="doc" width="64"></p>
<p><input type="button" value="Run"
onClick="run_transform(this.form)"></p>
</form>
@@ -40,7 +40,7 @@
The xsltc.jar file must contain the XSLTC runtime classes and your
pre-compiled translets, as described in the README.applet file.
-->
- <applet archive="xsltc.jar"
+ <applet archive="../../bin/xsltc.jar"
code="TransformApplet"
name="TransformApplet"
width="10"
1.2 +5 -1 xml-xalan/java/samples/CompiledApplet/README.applet
Index: README.applet
===================================================================
RCS file: /home/cvs/xml-xalan/java/samples/CompiledApplet/README.applet,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- README.applet 17 May 2001 15:36:29 -0000 1.1
+++ README.applet 28 Feb 2003 00:25:14 -0000 1.2
@@ -39,7 +39,8 @@
1. Install and configure Xalan with XSLTC
2. Compile the stylesheets you want to export. This will result in one
- or more small Java classes (translets).
+ or more small Java classes (translets). Store them under the same
+ directory as you put the TransformApplet class.
3. Create a JAR file with your the applet class (compile it first, of
cource), your translet classes and these classes from the xalan/xsltc
@@ -57,6 +58,9 @@
a file).
5. Open the supplied index.html and try out the demo!
+
+6. Using JDK1.4.0, it works on both IE5.5 and NetScape7.0. With lower
+ version of JDK, you may have problems with the JavaScript code
----------------------------------------------------------------------
KNOW PROBLEMS
1.3 +8 -2
xml-xalan/java/samples/extensions/sql/basic-connection/dbinfo.xml
Index: dbinfo.xml
===================================================================
RCS file:
/home/cvs/xml-xalan/java/samples/extensions/sql/basic-connection/dbinfo.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- dbinfo.xml 25 Jan 2002 19:41:31 -0000 1.2
+++ dbinfo.xml 28 Feb 2003 00:25:16 -0000 1.3
@@ -7,6 +7,12 @@
<user />
<password/>
</DBINFO>
-
-
+ <!-- an example setting for using DB2, sample is the database name
+ <DBINFO>
+ <dbdriver>COM.ibm.db2.jdbc.app.DB2Driver</dbdriver>
+ <dburl>jdbc:db2:sample</dburl>
+ <user />
+ <password/>
+ </DBINFO>
+-->
</dbtest>
1.6 +3 -1
xml-xalan/java/samples/extensions/sql/basic-connection/dbtest.xsl
Index: dbtest.xsl
===================================================================
RCS file:
/home/cvs/xml-xalan/java/samples/extensions/sql/basic-connection/dbtest.xsl,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- dbtest.xsl 25 Jan 2002 19:41:31 -0000 1.5
+++ dbtest.xsl 28 Feb 2003 00:25:17 -0000 1.6
@@ -20,7 +20,9 @@
<xsl:param name="query" select="'SELECT * FROM import1'"/>
+<xsl:param name="username" select="'***'"/>
+<xsl:param name="passwd" select="'***'"/>
<xsl:template match="/">
@@ -32,7 +34,7 @@
<!-- Connect to the database with minimal error detection -->
- <xsl:if test="not(sql:connect($db, $driver, $datasource))" >
+ <xsl:if test="not(sql:connect($db, $driver, $datasource,
$username, $passwd))" >
<xsl:message>Error Connecting to the Database</xsl:message>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]