You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Scott Edwards <se...@caresoft.com> on 2001/04/10 03:32:30 UTC
Xalan Redirect problems with Cocoon 1.8.2
I am trying to accomplish something which seems like it ought to be
quite simple. I am trying to use Xalan's redirect extension to save the
transformed output to a HTML file. I am getting some, but not all of the
data in the output file. I am not quite certain whether I am running
into a Xalan problem, or perhaps a Cocoon problem. Any assistance would
be great. I have pasted in the text of the XML and XSL files that I have
been playing with below.
Thanks,
-Scott Edwards
XML File:
<?xml version="1.0"?>
<!-- Author: Scott Edwards -->
<?xml-stylesheet href="splash-html.xsl" type="text/xsl"?>
<?cocoon-process type="xsp"?>
<?cocoon-process type="xslt"?>
<xsp:page xmlns:xsp="http://www.apache.org/1999/XSP/Core"
xmlns:request="http://www.apache.org/1999/XSP/Request">
<doctor>
<xsp:logic>
String xsl="splash-html.xsl";
String xslParam = request.getParameter("stylesheet");
if (xslParam != null){
xsl = xslParam;
}
</xsp:logic>
<!-- href="<xsp:expr><request:get-parameter
name="stylesheet"/></xsp:expr>" type="text/xsl"-->
<xsp:pi target="xml-stylesheet">
href="<xsp:expr>xsl</xsp:expr>" type="text/xsl"
</xsp:pi>
<about>
I like to take care of cooperative patients
</about>
<name>
<first-name>
Joe
</first-name>
<last-name>
Schmoe
</last-name>
<degree>
MD
</degree>
</name>
<specialty>
Stress Testing, Angioplasty/Angiograms, Gun Shot repair
</specialty>
<contact-info>
<location>
<street1>
123 Street Address
</street1>
<street2>
Suite No. A
</street2>
<city>
Sunnyvale
</city>
<state>
CA
</state>
<zip>
94086
</zip>
</location>
<phone>
408 990 4700
</phone>
<fax>
408 990 4777
</fax>
<email>
drstupid@caresoft.com
</email>
</contact-info>
<office-hours>
<monday>
closed
</monday>
<tuesday>
open
</tuesday>
<wednesday>
vegitation research (golf)
</wednesday>
<thursday>
hydrological skin treatments (scuba diving)
</thursday>
<friday>
sleep disorder research (closed and napping)
</friday>
<saturday>
closed - go away
</saturday>
<sunday>
really closed
</sunday>
</office-hours>
<education>
<medical-school>
Harvard on the Hill
</medical-school>
<additional>
MSEE - Optically Networked Baskets
</additional>
<fellowships>
Good Fellows Member
</fellowships>
<languages>
Valley speak, Pidgeon English
</languages>
</education>
<professional>
<hospital-affiliation>
<hospital>
Take your money Memorial
</hospital>
<hospital>
Dodgy treatment Medical Center
</hospital>
<hospital>
Athlete's Foot Clinic
</hospital>
</hospital-affiliation>
<associations>
<association>
ADA
</association>
<association>
AMA
</association>
<association>
GMAC
</association>
<association>
GEICO
</association>
</associations>
<insurance-plans-accepted>
<plan>
This one
</plan>
<plan>
That one
</plan>
<plan>
Medicare
</plan>
<plan>
Aetna
</plan>
<plan>
HMO of the West
</plan>
</insurance-plans-accepted>
</professional>
</doctor>
</xsp:page>
XSL File:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:lxslt="http://xml.apache.org/xslt"
xmlns:redirect="org.apache.xalan.xslt.extensions.Redirect"
extension-element-prefixes="redirect"
>
<!-- <xsl:param name="arg"/> -->
<xsl:template match="doctor">
<redirect:write file="z.html">
<html>
<head><title><xsl:apply-templates select="name"/></title></head>
<body>
<h2>
<xsl:apply-templates select="name"/>
</h2>
<hr/>
<br/><br/>
<table border='1'>
<tr>
<td colwidth="300" align="left" valign="top">
<a href="doctor.xml?stylesheet=details.xsl">Learn More About Me</a>
<br/>
<br/>
Image of Doctor w/Patient
</td>
<td colwidth="400">
<table border='1'>
<tr><td colwidth="200"></td><td colwidth="200"></td></tr>
<tr>
<td colspan="2" align="left" valign="top">
<xsl:apply-templates select="about"/>
</td>
</tr>
<tr>
<td colspan="2" align="left" valign="top">
<xsl:apply-templates select="specialty"/>
</td>
</tr>
<tr>
<td align="left" valign="top">
<xsl:apply-templates select="contact-info"/>
</td>
<td align="left" valign="top">
<xsl:apply-templates select="office-hours"/>
</td>
</tr>
</table>
</td>
</tr>
</table>
<br/><br/>
</body>
</html>
</redirect:write>
</xsl:template>
<xsl:template match="name">
<xsl:value-of select="first-name"/><xsl:text> </xsl:text>
<xsl:value-of select="last-name"/><xsl:text>,</xsl:text>
<xsl:value-of select="degree"/><xsl:text> - </xsl:text>
<xsl:value-of select="specialty"/>
</xsl:template>
<xsl:template match="contact-info">
<h3>
Location:
</h3>
<p>
<xsl:value-of select="location/street1"/>
<br/>
<xsl:value-of select="location/street2"/>
<br/>
<xsl:value-of select="location/city"/><xsl:text>
</xsl:text><xsl:value-of select="location/state"/><xsl:text>,
</xsl:text><xsl:value-of select="location/zip"/>
<br/>
</p>
<br/><br/>
<h3>
Office Phone:
</h3>
<p>
<xsl:value-of select="phone"/>
</p>
<br/><br/>
<h3>
Fax:
</h3>
<p>
<xsl:value-of select="fax"/>
</p>
<h3>
Email Address:
</h3>
<p>
<xsl:value-of select="email"/>
</p>
</xsl:template>
<xsl:template match="office-hours">
<h3>
Office Hours:
</h3>
<p>
Monday: <xsl:value-of select="monday"/>
<br/>
Tuesday: <xsl:value-of select="tuesday"/>
<br/>
Wednesday: <xsl:value-of select="wednesday"/>
<br/>
Thursday: <xsl:value-of select="thursday"/>
<br/>
Friday: <xsl:value-of select="friday"/>
<br/>
Saturday: <xsl:value-of select="saturday"/>
<br/>
Sunday: <xsl:value-of select="Sunday"/>
<br/>
</p>
</xsl:template>
</xsl:stylesheet>
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>