Hello. I am new to Cocoon and XML/XSL so please bare with
me.
cocoon 1.8.2
tomacat
Win2k
I have an XML document which is dynamically generated by
XYZFind (an XML database). This XML document is describing
the names of the XML documents (schemas) in the XYZFind database, such
as the following XML:
<?xml version="1.0"?>
<?cocoon-process type="xslt"?> <?xml-stylesheet href="uc.xsl" type="text/xsl"?> <xyz:output xmlns:xyz="http://xyzfind.com/schemas/xyzql/1.0"> <xyz:schema> <MedlineCitationSet/> <SEASON/> <resolution/> <spec/> </xyz:schema> </xyz:output> Using XSL, I am trying to create anchor tags which will link
to another XML file to display one of the schema's contents. This seems like an
obvious problem, though a day of searching has not turned up any
solution.
Here is my XML doc which grabs the above and results
in the exception found at the bottom.
<?xml version="1.0"?>
<?cocoon-process type="xsp"?> <?cocoon-process type="xslt"?> <?xml-stylesheet href="viewSchemas.xsl" type="text/xsl"?> <xsp:page language="java" xmlns:xsp="http://www.apache.org/1999/XSP/Core" xmlns:util="http://www.apache.org/1999/XSP/Util" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xyz="http://xyzfind.com/schemas/xyzql/1.0"> <xsp:structure> <xsp:include>uc.util.xyz.XYZBean</xsp:include> </xsp:structure> <xsp:logic> private String getXML() { XYZBean xyz = new XYZBean(); xyz.process(); xyz.getSchemas(); return xyz.getXMLString(); } </xsp:logic> <page> <util:include-expr><util:expr>getXML()</util:expr></util:include-expr> </page> </xsp:page> Where the first XML file is grabbed with the
getXML().
This is my XSL file:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xyz="http://xyzfind.com/schemas/xyzql/1.0" xmlns:xsp="http://www.apache.org/1999/XSP/Core"> <xsl:template match="page"> <html> <head> <title>XYZ Schema</title> </head> <body bgcolor="#ffffff"> Here is a list of schemas. Click on the link to view the entire schema. <b> <xsl:apply-templates select="xyz:output"/> </b> </body> </html> </xsl:template> <xsl:template match="xyz:output">
<xsl:apply-templates select="xyz:schema"/> </xsl:template> <xsl:template match="xyz:schema">
<xsl:apply-templates select="*"/> </xsl:template> <xsl:template match="*">
<br/> <a href="viewSchema.xml?document=<xsl:value-of select='name()'/>"><xsl:value-of select="name()"/></a> </xsl:template> </xsl:stylesheet>
org.apache.cocoon.processor.ProcessorException: Could not associate stylesheet to document: error reading C:\proprietary\server\tomcat\webapps\control\view\viewSchemas.xsl: org.xml.sax.SAXException: The value of attribute "href" must not contain the '<' character. [FATAL ERROR] [File: "file:C:/proprietary/server/tomcat/webapps/control/view/viewSchemas.xsl" Line: 34 Column: 39] (nested exception: org.xml.sax.SAXParseException: The value of attribute "href" must not contain the '<' character. ) at org.apache.cocoon.processor.xslt.XSLTProcessor.getStylesheet(XSLTProcessor.java:264) at org.apache.cocoon.processor.xslt.XSLTProcessor.process(XSLTProcessor.java:114) at org.apache.cocoon.Engine.handle(Engine.java:384) at org.apache.cocoon.Cocoon.service(Cocoon.java:183) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405) at org.apache.tomcat.core.Handler.service(Handler.java:287) at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372) at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797) at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743) at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:213) at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416) at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501) at java.lang.Thread.run(Thread.java:484) If I exclude —> <a href="viewSchema.xml?document="<... and leave =<xsl:value-of select='name()'/> Then I do not get the exception. So, in the end I am trying to have the resulting html look like <a href="viewSchema.xml?document=spec">spec</a> Thank you for your time. Daniel |
- Re: anchor tag/request object populated by tag name Daniel Urbano