RE: [xsl] Saxon8 beginner questions

Subject: RE: [xsl] Saxon8 beginner questions
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 20 Jul 2005 17:48:40 +0100
Firstly, to get this to run I had to change the encoding in both files -
they may have started life as utf-8, but they were not in UTF-8 by the time
they appeared in my email.

When you use the html output method, Saxon will insert a <meta> element as
part of the HTML <head> element. However, it won't do that if there isn't an
HTML <head> element. That's the case here, because your <head> element is
actually in the XHTML namespace, which the html output method doesn't
recognize. This also explains why the <br> element is being rendered the way
it is. You need to decide whether you are writing HTML or XHTML and then be
consistent.

Your call on current-date omitted the () so it was not recognized as a
function call (instead, Saxon looked for a child element called
current-date, and didn't find one).

The classpath is ignored by Java when you use the -jar option on the command
line. The message "Unable to access JAR file" means that you have mistyped
the path to the JAR file.

Michael Kay
http://www.saxonica.com/


> -----Original Message-----
> From: Manfred Staudinger [mailto:manfred.staudinger@xxxxxxxxx]
> Sent: 19 July 2005 20:59
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] Saxon8 beginner questions
>
> Hi,
> I do have same basic problems when using xslt and xpath with
> saxon8. Below are xml, xsl, and cmd for my minimal test-case.
>
> <?xml version="1.0" encoding="UTF-8" ?>
> <?xml-stylesheet type="text/xsl" href="docv2_2.xsl"?>
> <doc>
> Test f|r XSLT 2.0
> </doc>
>
> <?xml version="1.0" encoding="UTF-8" ?>
> <xsl:stylesheet version="2.0"
>    xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
> <xsl:output method="html"
>    doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
>    doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";
>    encoding="UTF-8"
>    omit-xml-declaration="yes" />
> <xsl:template match="/">
> <html xmlns="http://www.w3.org/1999/xhtml"; lang="de" xml:lang="de">
> <head><title>Test f|r XSLT 2.0</title>
> <link rel="stylesheet" href="Doku.css" type="text/css" />
> </head><body>
>    <h1><xsl:value-of select="." /></h1>
>    <xsl:value-of select="current-date" /><br />
> </body></html>
> </xsl:template>
> </xsl:stylesheet>
>
> java -jar C:\Programme\Saxon\saxon8.jar C:\staudinger\xml\docv2_2.xml
> docv2_2.xsl
>
> Now my problems:
> - it seems the output encoding="UTF-8" is not producing
>   a <meta charset=UTF-8" /> as it should, but I'm unable
>   to figure out why (despite I have seen it a few days ago)!
>   I can see also uuml; instead of | in the output, which
>   might be connected to the above.
> - the function current-date seems to return a null string.
> - empty xhtml tags are transformed into invalid sequences
>   like <br></br>
> - I specified CLASSPATH C:\Programme\Saxon\saxon8.jar
>   (nothing else) as a system environment variable (winnt sp6)
>   to no effect: when I omit the CLASSPATH the cmd above
>   still works, and when I try java -jar saxon8.jar ... I get the msg
>   "Unable to access jarfile saxon8.jar" and Exit code: 1
> - I would like to get a hint how to specify a minimum CLASSPATH
>   for this configuration: JDK 1.5 plus Saxon 8B.
>   I've installed java version "1.5.0_04"
>   Java(TM) 2 Runtime Environment, Standard Edition (build
> 1.5.0_04-b05)
>   Java HotSpot(TM) Client VM (build 1.5.0_04-b05, mixed mode, sharing)
>
> I like Saxon very much especially for being able to take a
> look on the output.
> Is there any way to see what Firefox or IE6 produce?
>
> Regards, Manfred Staudinger, Vienna

Current Thread