You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Mathias Reem <m....@gmx.net> on 2009/02/26 16:11:32 UTC

generating text output

Hi

I've got information about publications as a XML Input. And want to
generate bibtex output, therefore I use the following pipeline:

<map:generate type="file" src="in.xml"/>
<map:transform type="xsltc" src="bibtex.xslt"/>
<map:serialize type="text"/>

I want to generate the output as shown in out.txt, but only get the
following output:

foobar

All the other is missing. Can someone give me a hint howto generate my
desired output?

thx
	Mathias

Re: generating text output

Posted by Mathias Reem <m....@gmx.net>.
Hi

> However, you haven't specified any namespace prefix in the match 
> attribute, so it will only match a publication element with no 
> namespace (despite the default namespace you set in the XSL file) 
> while the element in your source document has a namespace.  As a 
> result, the default template of <xsl:apply-templates/> will be used 
> instead of the rest of your code, resulting in the output of the text
>  nodes from your document i.e. "foobar".  In the XSL file you need to
>  map some prefix to your "http://test" namespace and use that in the
>  match expression e.g. <xsl:template match="n:publication" 
> xmlns:n="http://test">

Doh. :-( Thanks a lot. It now works. Next time will check the xslt prior
searching the problem in cocoon.

cu
	Mathias

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: generating text output

Posted by Andy Stevens <in...@googlemail.com>.
2009/2/26 Mathias Reem <m....@gmx.net>:
> I've got information about publications as a XML Input. And want to
> generate bibtex output, therefore I use the following pipeline:
>
> <map:generate type="file" src="in.xml"/>
> <map:transform type="xsltc" src="bibtex.xslt"/>
> <map:serialize type="text"/>

Looks okay.

> I want to generate the output as shown in out.txt, but only get the
> following output:
>
> foobar
>
> All the other is missing. Can someone give me a hint howto generate my
> desired output?

The problem's probably in your XSL.  You have
<publication xmlns="http://test" key="pub">
in the source doc and try to match it with
<xsl:template match="publication">
in the XSL.  However, you haven't specified any namespace prefix in
the match attribute, so it will only match a publication element with
no namespace (despite the default namespace you set in the XSL file)
while the element in your source document has a namespace.  As a
result, the default template of <xsl:apply-templates/> will be used
instead of the rest of your code, resulting in the output of the text
nodes from your document i.e. "foobar".  In the XSL file you need to
map some prefix to your "http://test" namespace and use that in the
match expression e.g.
<xsl:template match="n:publication" xmlns:n="http://test">

The same applies to the authors/author expressions in your xsl:if and
xsl:for-each, and the select expressions in the xsl:value-of elements
- they only match elements with no namespace, while of your source
document's elements are in the specified default namespace
(http://test).  Try the attached XSL code instead.

This isn't really a Cocoon issue, though, just general XSL.  There are
probably more appropriate forums.


Andy
-- 
http://pseudoq.sourceforge.net/  Open source Sudoku creator