cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Corey O'Donovan" ...@feersumendjinns.com>
Subject Re: Plain text from Cocoon
Date Tue, 06 Feb 2001 17:10:44 GMT
Hi,

You have to use a root tag in xsl, but it won't show in the resulting
document if you set the format to text/plain.
Try this stylesheet:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:template match="Personalia">
 <xsl:processing-instruction
name="cocoon-format">type="text/plain"</xsl:processing-instruction>
 <plain-text>
  <xsl:for-each select="Navn">
   <xsl:value-of select="Fornavn" />
  </xsl:for-each>
 </plain-text>
</xsl:template>
</xsl:stylesheet>

Corey

----- Original Message -----
From: Abid Ali Teepo <abid.ali.teepo@mogul.com>
To: <cocoon-users@xml.apache.org>
Sent: Tuesday, February 06, 2001 4:38 PM
Subject: Plain text from Cocoon


>
> Hi!
>
> I wan't plain text output from cocoon, but somehow it gives an
> error message unless i include som html-tags. How can i get plain
> text without the tags ?
>
> My XML page looks like this :
> ------------------------------------------------------------------------
> -
> <?xml version="1.0" encoding="UTF-8"?>
> <?xml-stylesheet href="phonebook-plain.xsl" type="text/xsl"?>
> <?cocoon-process type="xslt"?>
> <Personalia>
> <Navn><Fornavn>Ole<Initialer>O.O</Initialer>
> </Fornavn>
> <Etternavn>Olsen</Etternavn>
> </Navn>
> <Navn><Fornavn>Per<Initialer>P.P</Initialer>
> </Fornavn>
> <Etternavn>Person</Etternavn>
> </Navn>
> </Personalia>
> ------------------------------------------------------------------------
> -
> And my XSL page looks like this :
> ------------------------------------------------------------------------
> -
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:fo="http://www.w3.org/1999/XSL/Format">
>
> <xsl:template match="Personalia">
> <xsl:for-each select="Navn">
> <xsl:value-of select="Fornavn" />
>
> </xsl:for-each>
> </xsl:template>
> </xsl:stylesheet>
> ------------------------------------------------------------------------
> ---
> The ERROR message looks like this :
> ------------------------------------------------------------------------
> ---
>
>
>
> Error found handling the request.
> org.apache.xalan.xslt.XSLProcessorException: Warning: can't output text
> before document element!  Ignoring...
> at
> org.apache.xalan.xslt.XSLTEngineImpl.error(XSLTEngineImpl.java:1710)
> at
> org.apache.xalan.xslt.XSLTEngineImpl.error(XSLTEngineImpl.java:1674)
> at
> org.apache.xalan.xslt.XSLTEngineImpl.process(XSLTEngineImpl.java:703)
> at
> org.apache.cocoon.transformer.XalanTransformer.transform(XalanTransforme
> r.java:107)
> at
> org.apache.cocoon.processor.xslt.XSLTProcessor.process(XSLTProcessor.jav
> a:116)
> 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
> weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.
> java:208)
> at
> weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServl
> etContext.java:1127)
> at
> weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.
> java:1529)
> at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
> at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
> ---------
> org.xml.sax.SAXException: Warning: can't output text before document
> element!  Ignoring...
> at
> org.apache.xalan.xpath.xml.FormatterToDOM.append(FormatterToDOM.java:147
> )
> at
> org.apache.xalan.xpath.xml.FormatterToDOM.characters(FormatterToDOM.java
> :331)
> at
> org.apache.xalan.xslt.XSLTEngineImpl$ResultTreeHandler.characters(XSLTEn
> gineImpl.java:4021)
> at
> org.apache.xalan.xslt.ElemValueOf.execute(ElemValueOf.java:211)
> at
> org.apache.xalan.xslt.ElemTemplateElement.executeChildren(ElemTemplateEl
> ement.java:661)
> at
> org.apache.xalan.xslt.ElemTemplateElement.transformChild(ElemTemplateEle
> ment.java:1199)
> at
> org.apache.xalan.xslt.ElemTemplateElement.processLocatedNode(ElemTemplat
> eElement.java:1061)
> at
> org.apache.xalan.xpath.SimpleNodeLocator.findChildren(SimpleNodeLocator.
> java:773)
> at
> org.apache.xalan.xpath.SimpleNodeLocator.step(SimpleNodeLocator.java:428
> )
> at
> org.apache.xalan.xpath.SimpleNodeLocator.locationPath(SimpleNodeLocator.
> java:321)
> at org.apache.xalan.xpath.XPath.locationPath(XPath.java:964)
> at org.apache.xalan.xpath.XPath.execute(XPath.java:1385)
> at org.apache.xalan.xpath.XPath.execute(XPath.java:1354)
> at org.apache.xalan.xpath.XPath.execute(XPath.java:311)
> at
> org.apache.xalan.xslt.ElemTemplateElement.transformSelectedChildren(Elem
> TemplateElement.java:896)
> at
> org.apache.xalan.xslt.ElemForEach.execute(ElemForEach.java:134)
> at
> org.apache.xalan.xslt.ElemTemplateElement.executeChildren(ElemTemplateEl
> ement.java:661)
> at
> org.apache.xalan.xslt.ElemTemplateElement.transformChild(ElemTemplateEle
> ment.java:1199)
> at
> org.apache.xalan.xslt.ElemTemplateElement.processLocatedNode(ElemTemplat
> eElement.java:1061)
> at
> org.apache.xalan.xpath.SimpleNodeLocator.findChildren(SimpleNodeLocator.
> java:773)
> at
> org.apache.xalan.xpath.SimpleNodeLocator.step(SimpleNodeLocator.java:428
> )
> at
> org.apache.xalan.xpath.SimpleNodeLocator.locationPath(SimpleNodeLocator.
> java:321)
> at org.apache.xalan.xpath.XPath.locationPath(XPath.java:964)
> at org.apache.xalan.xpath.XPath.execute(XPath.java:1385)
> at org.apache.xalan.xpath.XPath.execute(XPath.java:1354)
> at org.apache.xalan.xpath.XPath.execute(XPath.java:311)
> at
> org.apache.xalan.xslt.ElemTemplateElement.transformSelectedChildren(Elem
> TemplateElement.java:896)
> at
> org.apache.xalan.xslt.ElemApplyTemplates.execute(ElemApplyTemplates.java
> :176)
> at
> org.apache.xalan.xslt.ElemTemplateElement.executeChildren(ElemTemplateEl
> ement.java:661)
> at
> org.apache.xalan.xslt.ElemTemplate.execute(ElemTemplate.java:145)
> at
> org.apache.xalan.xslt.StylesheetRoot.process(StylesheetRoot.java:444)
> at
> org.apache.xalan.xslt.XSLTEngineImpl.process(XSLTEngineImpl.java:679)
> at
> org.apache.cocoon.transformer.XalanTransformer.transform(XalanTransforme
> r.java:107)
> at
> org.apache.cocoon.processor.xslt.XSLTProcessor.process(XSLTProcessor.jav
> a:116)
> 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
> weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.
> java:208)
> at
> weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServl
> etContext.java:1127)
> at
> weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.
> java:1529)
> at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
> at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
>
> ---------------------------------------------------------------------
> 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: <cocoon-users-unsubscribe@xml.apache.org>
> For additional commands, e-mail: <cocoon-users-help@xml.apache.org>


Mime
View raw message