You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Ken Abbott <ab...@acm.org> on 2001/04/17 15:44:31 UTC

XSL translation of id() works standalone but not inside Cocoon

I'm using Cocoon 1.8.2 on Windows 2000.

When I use an XSL transformation that is invoked inside Cocoon (e.g. by
visiting an XML page that specifies an XSL stylesheet containing the
following lines), the first line transforms correctly to the FirstName, but
the second line produces no output.   When I configure XML Spy to use the
Xalan XSL transformer "standalone" and invoke it directly on the same XML
file, both lines below produce the same output (the FirstName).

XSL fragment:
<root>
<NoId><xsl:value-of select="//Contact/Name/FirstName"/></NoId>
<Id><xsl:value-of
select="id(//Appointment/AttendeeContact/@id)/Name/FirstName"/></Id>
</root>

Output When Run through XSL processor standalone:
<root
xmlns:fo="http://www.w3.org/1999/XSL/Format"><NoId>Susan</NoId><Id>Susan</Id
></root>

Output When Invoked as Cocoon XSLT Processor:
<root
xmlns:fo="http://www.w3.org/1999/XSL/Format"><NoId>Susan</NoId><Id></Id></ro
ot>

Has anybody else encountered problems with using the id() construct within
Cocoon? Is there a workaround?  Any insights into why the XSL processor
behaves differently when invoked from within Cocoon as opposed to
standalone?

Kenneth R. Abbott / abbott@acm.org
Merryn Systems Corp.
V: (508)259-1238 / F: (508)429-8264

Re: XSL translation of id() works standalone but not inside Cocoon

Posted by Jeremy Quinn <je...@media.demon.co.uk>.
At 3:50 PM +0200 17/4/01, Sylvain Wallez wrote:
>
>I think it has to do with XML validation : in order to use the XSL id()
>function, your document must have an associated DTD that defines the ID
>attribute. The default in Cocoon is to perform no validation on XML
>documents (this speeds up parsing), and this can be the reason why the
>XSL processor doesn't know about it.
>
>Try to change "parser.validate" to "true" in cocoon.properties to
>activate XML validation. This can be the workaround.

I started using DTDs recently ....

I needed to add a reference to a DTD for my document that can add default
xlink:attributes to specific tags, it works fine ;)

Having a DTD loaded with your document does not require that you turn
validation on, I suspect the same may be true for making usable IDs.


regards Jeremy
-- 
   ___________________________________________________________________

   Jeremy Quinn                                           Karma Divers
                                                       webSpace Design
                                            HyperMedia Research Centre

   <ma...@mac.com>     		 <http://www.media.demon.co.uk>
    <phone:+44.[0].20.7737.6831>        <pa...@sms.genie.co.uk>

---------------------------------------------------------------------
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>


Re: XSL translation of id() works standalone but not inside Cocoon

Posted by Sylvain Wallez <sy...@anyware-tech.com>.

Ken Abbott a écrit :
> 
> I'm using Cocoon 1.8.2 on Windows 2000.
> 
> When I use an XSL transformation that is invoked inside Cocoon (e.g. by
> visiting an XML page that specifies an XSL stylesheet containing the
> following lines), the first line transforms correctly to the FirstName, but
> the second line produces no output.   When I configure XML Spy to use the
> Xalan XSL transformer "standalone" and invoke it directly on the same XML
> file, both lines below produce the same output (the FirstName).
> 
> XSL fragment:
> <root>
> <NoId><xsl:value-of select="//Contact/Name/FirstName"/></NoId>
> <Id><xsl:value-of
> select="id(//Appointment/AttendeeContact/@id)/Name/FirstName"/></Id>
> </root>
> 
> Output When Run through XSL processor standalone:
> <root
> xmlns:fo="http://www.w3.org/1999/XSL/Format"><NoId>Susan</NoId><Id>Susan</Id
> ></root>
> 
> Output When Invoked as Cocoon XSLT Processor:
> <root
> xmlns:fo="http://www.w3.org/1999/XSL/Format"><NoId>Susan</NoId><Id></Id></ro
> ot>
> 
> Has anybody else encountered problems with using the id() construct within
> Cocoon? Is there a workaround?  Any insights into why the XSL processor
> behaves differently when invoked from within Cocoon as opposed to
> standalone?
> 
> Kenneth R. Abbott / abbott@acm.org
> Merryn Systems Corp.
> V: (508)259-1238 / F: (508)429-8264
> 

I think it has to do with XML validation : in order to use the XSL id()
function, your document must have an associated DTD that defines the ID
attribute. The default in Cocoon is to perform no validation on XML
documents (this speeds up parsing), and this can be the reason why the
XSL processor doesn't know about it.

Try to change "parser.validate" to "true" in cocoon.properties to
activate XML validation. This can be the workaround.

Hope this helps
-- 
Sylvain Wallez
Anyware Technologies - http://www.anyware-tech.com

---------------------------------------------------------------------
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>