You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Robert A. Lentz" <ra...@ralentz.com> on 2000/12/21 22:28:02 UTC

Xalan-J 1.2.2 weird redirect behavior

[judging from the lack of this message in the archives, it did not make it 
through the first time I sent its last Friday.]

Greetings,

(using version j1.2.2, and sun's Java 1.3_01)

I am getting some weird behavior with regards to the XML label and document 
type.

------------------------
source XML:

<?xml version="1.0"?>
<xhtml>
         <title keywords="Robert Andrew Lentz">
                 RALentz.com
         </title>

         <description>The personal site of Robert Andrew Lentz with 
information and essays on space exploration and development, astronomy, 
society, and politics, Macintosh, Web, and more.</description>

         <body area="home">
         </body>
</xhtml>

------------------------
source XSL:

<?xml version="1.0"?>

<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
         xmlns:redirect="org.apache.xalan.xslt.extensions.Redirect"
         extension-element-prefixes="redirect"
         exclude-result-prefixes="redirect">

<xsl:output method="xml"/>
<xsl:output omit-xml-declaration="no"/>
<xsl:output doctype-system="DTD/xhtml1-strict.dtd"
         doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"/>

<xsl:output indent="yes"/>

<xsl:strip-space elements="*"/>


<xsl:template match="xhtml">
         <redirect:open file="test.html"/>
                 <redirect:write file="test.html">
                         boo
                 </redirect:write>
         <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
                 <xsl:apply-templates select="title | body"/>
         </html>
         <redirect:close file="test.html"/>
</xsl:template>


<xsl:template match="title">
<head>
         <title>
         <xsl:value-of select="."/>
         </title>

         <link rel="StyleSheet" href="style.css" type="text/css" 
media="Screen" />

         <meta http-equiv="keywords" content="{@keywords}" />

         <xsl:message>about to foo</xsl:message>

         <redirect:write file="test2.html">

                 <xsl:message>foo</xsl:message>

                 foo
                 <xsl:apply-templates 
select="following-sibling::*[position()!=last()]"/>
         </redirect:write>
</head>
</xsl:template>


<xsl:template match="description">
         <meta http-equiv="description" content="{.}" />
</xsl:template>


<xsl:template match="body">
<body class="{@area}">
         <table class="body">
                 <xsl:apply-templates select="./*"/>
         </table>
</body>
</xsl:template>


</xsl:transform>

------------------------
test.html

<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>

                         boo


------------------------
test2.html

<?xml version="1.0" encoding="UTF-8"?>


                 foo
                 <!DOCTYPE meta PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"DTD/xhtml1-strict.dtd">
<meta content="The personal site of Robert Andrew Lentz with information 
and essays on space exploration and development, astronomy, society, and 
politics, Macintosh, Web, and more." http-equiv="description" />

------------------------

the standard output comes out fine.


The sample redirect given on the extensions Web page works fine, but if I 
make a similar modification to the example style sheets like so:

                 <xsl:output method="xml"/>
                 <xsl:output omit-xml-declaration="no"/>
                 <xsl:output doctype-system="DTD/xhtml1-strict.dtd"
                         doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"/>

and:

                 <redirect:write file="foo.out">
                 boo
                         <foo-out>
                                 <xsl:apply-templates/>
                         </foo-out>

then I do get similar behavior:

<?xml version="1.0" encoding="UTF-8"?>

                 boo
                         <!DOCTYPE foo-out PUBLIC "-//W3C//DTD XHTML 1.0 
Strict//EN" "DTD/xhtml1-strict.dtd">


(And when having things improperly set up I have also run into the error 
message about not being able to find class com.ibm.bsf.BSFException that 
others have reported as well)

Because of the traffic I have not subscribed, please make sure a copy of 
your reply is sent to me.

thank you,
-Robert

-- 
ralentz@ralentz.com                       http://www.ralentz.com/old/plan.html
Andrea:   Unhappy the land that has no heroes.
Galileo:  No, unhappy the land that *needs* heroes.
                                     -- Bertolt Brecht, "Life of Galileo"