You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Martin Holmes <mh...@uvic.ca> on 2006/01/26 19:54:16 UTC

Cocoon XSLT and schema documents

Hi there,

I have some XML documents (TEI P5) that start like this:

<TEI  xmlns="http://www.tei-c.org/ns/1.0" version="5.0" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://www.tei-c.org/ns/1.0 imt_p5.xsd" 
xmlns:svg="http://www.w3.org/2000/svg">

When XSLT transformations are run against them, no templates are 
applied, so plain text is all that shows up. However, when I remove all 
the attributes from the root element:

<TEI>

the transformations work fine. Does anyone know why this might be? I see 
the same behaviour in oXygen, so it's most likely something I'm doing 
wrong rather than a Cocoon problem, but the documents validate just fine.

All help appreciated,
Martin


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


Re: Cocoon XSLT and schema documents

Posted by Martin Holmes <mh...@uvic.ca>.
Doh!

Thanks for this. I guess I have a long job trawling through my 
stylesheets to add the namespace prefix.

Cheers,
Martin

Andrew Stevens wrote:
>>> From: Martin Holmes <mh...@uvic.ca>
>>> Date: Thu, 26 Jan 2006 10:54:16 -0800
>>>
>>> Hi there,
>>>
>>> I have some XML documents (TEI P5) that start like this:
>>>
>>> <TEI  xmlns="http://www.tei-c.org/ns/1.0"
>>
>> setting the element's namespace to http://www.tei-c.org/ns/1.0, I notice
>>
>> ...
>>> When XSLT transformations are run against them, no templates are 
>>> applied, so plain text is all that shows up. However, when I remove 
>>> all the attributes from the root element:
>>>
>>> <TEI>
>>>
>>> the transformations work fine.
>>
>> My guess is your XSL tempates don't include the namespaces, so are 
>> looking to match elements in the default (i.e. no) namespace?
>>
>> <xsl:stylesheet xmlns:tei
> 
> Oops, hit the wrong key.  Should have been
> 
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:tei="http://www.tei-c.org/ns/1.0">
> <xsl:template match="tei:TEI">
> Matches.
> </xsl:template>
> <xsl:template match="TEI">
> Doesn't match.
> </xsl:template>
> <xsl:template match="undeclared:TEI">
> Doesn't match either.
> </xsl:template>
> </xsl:stylesheet>
> 
> or something along those lines.  Also keep in mind the actual prefixes 
> used don't matter, it's the namespace URIs that need to match.
> 
> 
> Andrew.


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


RE: Cocoon XSLT and schema documents

Posted by Andrew Stevens <at...@hotmail.com>.
>>From: Martin Holmes <mh...@uvic.ca>
>>Date: Thu, 26 Jan 2006 10:54:16 -0800
>>
>>Hi there,
>>
>>I have some XML documents (TEI P5) that start like this:
>>
>><TEI  xmlns="http://www.tei-c.org/ns/1.0"
>
>setting the element's namespace to http://www.tei-c.org/ns/1.0, I notice
>
>...
>>When XSLT transformations are run against them, no templates are applied, 
>>so plain text is all that shows up. However, when I remove all the 
>>attributes from the root element:
>>
>><TEI>
>>
>>the transformations work fine.
>
>My guess is your XSL tempates don't include the namespaces, so are looking 
>to match elements in the default (i.e. no) namespace?
>
><xsl:stylesheet xmlns:tei

Oops, hit the wrong key.  Should have been

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:tei="http://www.tei-c.org/ns/1.0">
<xsl:template match="tei:TEI">
Matches.
</xsl:template>
<xsl:template match="TEI">
Doesn't match.
</xsl:template>
<xsl:template match="undeclared:TEI">
Doesn't match either.
</xsl:template>
</xsl:stylesheet>

or something along those lines.  Also keep in mind the actual prefixes used 
don't matter, it's the namespace URIs that need to match.


Andrew.



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


RE: Cocoon XSLT and schema documents

Posted by Andrew Stevens <at...@hotmail.com>.
>From: Martin Holmes <mh...@uvic.ca>
>Date: Thu, 26 Jan 2006 10:54:16 -0800
>
>Hi there,
>
>I have some XML documents (TEI P5) that start like this:
>
><TEI  xmlns="http://www.tei-c.org/ns/1.0"

setting the element's namespace to http://www.tei-c.org/ns/1.0, I notice

...
>When XSLT transformations are run against them, no templates are applied, 
>so plain text is all that shows up. However, when I remove all the 
>attributes from the root element:
>
><TEI>
>
>the transformations work fine.

My guess is your XSL tempates don't include the namespaces, so are looking 
to match elements in the default (i.e. no) namespace?

<xsl:stylesheet xmlns:tei


Andrew.



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