You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Jason Dusek <ja...@gmail.com> on 2005/10/10 04:54:33 UTC

cocoon & catalogs

i would like to have cocoon look at a document like this:

<layout
  xsi:schemaLocation="space://layout schema://layout"
  xmlns="space://layout">
 <data/>
</layout>

and finds its schema based on this catalog entry:

SYSTEM "schema://layout where/is/it/layout.xsd"

what i've done so far is write my own catalog, and reference it in the
cocoon catalog in context://WEB-INF/entities/

-- jsn's stuff --
CATALOG "/home/jsn/public_html/resources/catalogs/catalog"

but this doesn't work at all - when i try to reference the schema in
xslt, it just dumps all the text-nodes. where can i go for help on
this? i've been searching the net for 1.5+ days and basically get a lot
of specs.
--
_jason

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


Re: cocoon & catalogs

Posted by Jason Dusek <ja...@gmail.com>.
i'm an idiot! I've been using firefox to look at the output xml, and
by default it doesn't show attributes! so no matter what, i never see
the namespaces! today by chance I happenned to 'view source', and
there they were.
--
_jason

On 10/11/05, Geert Josten <Ge...@daidalos.nl> wrote:
> Hmmm, never used that function before...
>
> You could revert to <xsl:key .. /> and key(...) with which it should be able to do the same, I think..
>
> :)
>
> Jason Dusek wrote:
>
> >>Just for _processing_ the xml namespaces aware the actual schema is not
> >
> >
> > this is not true - if you want to use
> >
> >   <xsl:template select="id('some-id')">
> >     <!-- etc. -->
> >   </xsl:template>
> >
> > then the schema has to specify that your id attributes are of type
> > xs:ID, as it says in the spec:
> >
> >        NOTE:In order for such an attribute to be used with the XPath id
> >        function, it must actually be declared in the DTD as being an ID.
> >
> >           (from http://www.w3.org/TR/xslt#section-Embedding-Stylesheets)
> >
> > that's why i started writing schemas and putting in namespaces in the
> > first place.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > For additional commands, e-mail: users-help@cocoon.apache.org
> >
> >
>
> --
> Drs. G.P.H. Josten
> Consultant
>
>
>
> Daidalos BV
> Source of Innovation
> Hoekeindsehof 1-4
> 2665  JZ  Bleiswijk
> Tel: +31 (0) 10 850 1200
> Fax: +31 (0) 10 850 1199
> www.daidalos.nl
>
>
> De informatie - verzonden in of met dit emailbericht - is afkomstig van Daidalos BV en is
> uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onbedoeld hebt ontvangen, verzoeken
> wij u het te verwijderen. Aan dit bericht kunnen geen rechten worden ontleend.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>


--
_jason

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


Re: cocoon & catalogs

Posted by Geert Josten <Ge...@daidalos.nl>.
Hmmm, never used that function before...

You could revert to <xsl:key .. /> and key(...) with which it should be able to do the same, I think..

:)

Jason Dusek wrote:

>>Just for _processing_ the xml namespaces aware the actual schema is not
> 
> 
> this is not true - if you want to use
> 
>   <xsl:template select="id('some-id')">
>     <!-- etc. -->
>   </xsl:template>
> 
> then the schema has to specify that your id attributes are of type
> xs:ID, as it says in the spec:
> 
>        NOTE:In order for such an attribute to be used with the XPath id
>        function, it must actually be declared in the DTD as being an ID.
> 
>           (from http://www.w3.org/TR/xslt#section-Embedding-Stylesheets)
> 
> that's why i started writing schemas and putting in namespaces in the
> first place.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
> 

-- 
Drs. G.P.H. Josten
Consultant



Daidalos BV
Source of Innovation
Hoekeindsehof 1-4
2665  JZ  Bleiswijk
Tel: +31 (0) 10 850 1200
Fax: +31 (0) 10 850 1199
www.daidalos.nl


De informatie - verzonden in of met dit emailbericht - is afkomstig van Daidalos BV en is 
uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onbedoeld hebt ontvangen, verzoeken 
wij u het te verwijderen. Aan dit bericht kunnen geen rechten worden ontleend.

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


Re: cocoon & catalogs

Posted by Jason Dusek <ja...@gmail.com>.
>Just for _processing_ the xml namespaces aware the actual schema is not

this is not true - if you want to use

  <xsl:template select="id('some-id')">
    <!-- etc. -->
  </xsl:template>

then the schema has to specify that your id attributes are of type
xs:ID, as it says in the spec:

       NOTE:In order for such an attribute to be used with the XPath id
       function, it must actually be declared in the DTD as being an ID.

          (from http://www.w3.org/TR/xslt#section-Embedding-Stylesheets)

that's why i started writing schemas and putting in namespaces in the
first place.

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


Re: cocoon & catalogs

Posted by Geert Josten <Ge...@daidalos.nl>.
Hi,

 > > Besides, the catalog system is only for DTD's and
 > > usually not used for locating schema's.
 >
 > so how am i supposed to redirect for schemas, then? is there a
 > 'standard' way to do this, like with catalogs? does it go in
 > cocoon.xconf or something like that? i don't want to use catalogs or
 > hack up cocoon if i don't have to.

How do you mean redirect? Just for _processing_ the xml namespaces aware the actual schema is not 
required. If you want to validate the input or the result, then using the schemaLocation approach 
should be sufficient, but you might have to set a flag that input should be validated. If you want 
to validate the result there is the ValidatingTransformer (is it still around?) which takes 
schemalocations as parameters, or I believe the saxon parser has some nice xslt 2 features to do 
things like that.

Jason Dusek wrote:
> the xslt does not output a namespace declaration for my xml. here is a
> fuller example:
> 
> <xsl:stylsheet
>     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>     xmlns:lay="space://layout">
> 
>   <xsl:template match="resume">
>     <lay:layout>
>       <xsl:apply-templates/>
>     </lay:layout>
>   </xsl:template>
> 
>   <!-- more of the same -->
> 
> </xsl:stylesheet>
> 
> the output looks like this:
> 
> <?xml encoding="ISO-SOMETHING-OR-OTHER" version="1.0"?>
> <lay:layout>
>   <!-- more of the same -->
> </lay:layout>

Can you tell how your sitemap looks like? That sounds really odd.

By the way, the output instructions of the xsl stylesheet are ignored as the sax events are rerouted 
directly to the following transformer or serializer. Could it be that you are using the html 
serializer or a non-standard xml serializer? There were two versions of serializers a few versions ago.

If you want to output utf-8, add the following to the configuration of you serializer:

	<encoding>utf-8</encoding>

Cheers,
Geert

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


Re: cocoon & catalogs

Posted by Jason Dusek <ja...@gmail.com>.
the xslt does not output a namespace declaration for my xml. here is a
fuller example:

<xsl:stylsheet
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:lay="space://layout">

  <xsl:template match="resume">
    <lay:layout>
      <xsl:apply-templates/>
    </lay:layout>
  </xsl:template>

  <!-- more of the same -->

</xsl:stylesheet>

the output looks like this:

<?xml encoding="ISO-SOMETHING-OR-OTHER" version="1.0"?>
<lay:layout>
  <!-- more of the same -->
</lay:layout>

notice that there is no namespace declaration. (btw, how do i change
the default encoding to utf-8?) so i thought, maybe if i add the
schemaLocation to my code, cocoon will realize that it's a real
namespace and output the namespace declaration. however, this doesn't
work:

<xsl:stylsheet
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:lay="space://layout">

  <xsl:template match="resume">
    <lay:layout xsi:schemaLocation="space://layout schema://layout">
      <xsl:apply-templates/>
    </lay:layout>
  </xsl:template>

  <!-- more of the same -->

</xsl:stylesheet>

when i run this transform, the transformer just dumps all the text
nodes in an invalid document.

> Besides, the catalog system is only for DTD's and
> usually not used for locating schema's.

so how am i supposed to redirect for schemas, then? is there a
'standard' way to do this, like with catalogs? does it go in
cocoon.xconf or something like that? i don't want to use catalogs or
hack up cocoon if i don't have to.
--
_jason

On 10/10/05, Geert Josten <Ge...@daidalos.nl> wrote:
> Hi Jason,
>
> First of all, what do you expect to happen by referencing to a schema from an xslt? XSLT (1.0) isn't
> meant to care for DTD's and Schema's other that adding doctypes or namespaces.
>
> Even the FileGenerator doesn't care for doctypes and schema references. If you want to verify your
> xml, you will have to start a validating process explicitly.
>
> There was a ValidatingTransformer available in the community, I believe.
>
> Besides, the catalog system is only for DTD's and usually not used for locating schema's. It should
> not be difficult to hook the catalog system to a URIResolver that is used for locating the schema's,
> but you will have to dig in Java code..
>
> HTH,
> Geert
>
> Jason Dusek wrote:
>
> > i would like to have cocoon look at a document like this:
> >
> > <layout
> >   xsi:schemaLocation="space://layout schema://layout"
> >   xmlns="space://layout">
> >  <data/>
> > </layout>
> >
> > and finds its schema based on this catalog entry:
> >
> > SYSTEM "schema://layout where/is/it/layout.xsd"
> >
> > what i've done so far is write my own catalog, and reference it in the
> > cocoon catalog in context://WEB-INF/entities/
> >
> > -- jsn's stuff --
> > CATALOG "/home/jsn/public_html/resources/catalogs/catalog"
> >
> > but this doesn't work at all - when i try to reference the schema in
> > xslt, it just dumps all the text-nodes. where can i go for help on
> > this? i've been searching the net for 1.5+ days and basically get a lot
> > of specs.
> > --
> > _jason
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > For additional commands, e-mail: users-help@cocoon.apache.org
> >
> >
>
> --
> Drs. G.P.H. Josten
> Consultant
>
>
>
> Daidalos BV
> Source of Innovation
> Hoekeindsehof 1-4
> 2665  JZ  Bleiswijk
> Tel: +31 (0) 10 850 1200
> Fax: +31 (0) 10 850 1199
> www.daidalos.nl
>
>
> De informatie - verzonden in of met dit emailbericht - is afkomstig van Daidalos BV en is
> uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onbedoeld hebt ontvangen, verzoeken
> wij u het te verwijderen. Aan dit bericht kunnen geen rechten worden ontleend.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>


--
_jason

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


Re: cocoon & catalogs

Posted by Geert Josten <Ge...@daidalos.nl>.
Hi Jason,

First of all, what do you expect to happen by referencing to a schema from an xslt? XSLT (1.0) isn't 
meant to care for DTD's and Schema's other that adding doctypes or namespaces.

Even the FileGenerator doesn't care for doctypes and schema references. If you want to verify your 
xml, you will have to start a validating process explicitly.

There was a ValidatingTransformer available in the community, I believe.

Besides, the catalog system is only for DTD's and usually not used for locating schema's. It should 
not be difficult to hook the catalog system to a URIResolver that is used for locating the schema's, 
but you will have to dig in Java code..

HTH,
Geert

Jason Dusek wrote:

> i would like to have cocoon look at a document like this:
> 
> <layout
>   xsi:schemaLocation="space://layout schema://layout"
>   xmlns="space://layout">
>  <data/>
> </layout>
> 
> and finds its schema based on this catalog entry:
> 
> SYSTEM "schema://layout where/is/it/layout.xsd"
> 
> what i've done so far is write my own catalog, and reference it in the
> cocoon catalog in context://WEB-INF/entities/
> 
> -- jsn's stuff --
> CATALOG "/home/jsn/public_html/resources/catalogs/catalog"
> 
> but this doesn't work at all - when i try to reference the schema in
> xslt, it just dumps all the text-nodes. where can i go for help on
> this? i've been searching the net for 1.5+ days and basically get a lot
> of specs.
> --
> _jason
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
> 

-- 
Drs. G.P.H. Josten
Consultant



Daidalos BV
Source of Innovation
Hoekeindsehof 1-4
2665  JZ  Bleiswijk
Tel: +31 (0) 10 850 1200
Fax: +31 (0) 10 850 1199
www.daidalos.nl


De informatie - verzonden in of met dit emailbericht - is afkomstig van Daidalos BV en is 
uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onbedoeld hebt ontvangen, verzoeken 
wij u het te verwijderen. Aan dit bericht kunnen geen rechten worden ontleend.

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