You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Peter Kharchenko <pe...@interactivebusiness.com> on 2000/04/17 22:58:18 UTC
XSLT questions.
Hi there,
I have a couple of rather basic questions on associating XSLT stylesheets with XML
documents. I've read the w3c recommendation on that subject
(http://www.w3.org/1999/06/REC-xml-stylesheet-19990629/), but couldn't find an
answer. I hope one of you guys can help me out.
I was wondering if it's possible to associate stylesheet with a particular XML node
instead of a whole document. For example if I have the following document,
--------------------
<book>
<index> ... </index>
<chapter> ... </chapter>
<chapter> ... </chapter>
</book>
--------------------
I would like to associate a different stylesheet with each of the <chapter> nodes
(because chapters might differ in their formats).
In java, there's a straightforward way of applying a stylesheet to a DOM tree
specified by a particular node, such as a <chapter> element, however I do not know a
way of creating an XML processing instruction to do that. Is there a way to do that,
or are we restricted to specifying stylesheet binding only to the entire document ?
Second question is somewhat similar. I would like to have an XML document that
includes other XML documents. Does cocoon support Xinclude syntax (<xinclude:include
href="other.xml"/>) ? And, if so, how are the XSLT transformations performed ? If
"other.xml" specifies its own stylesheet, will it be processed prior to stylesheets
specified in the main document ?
Sorry if my questions are very basic. If the answers are obvious, please point me an
example I can look at :)
Thanks,
-peter.
Re: XSLT questions.
Posted by Stefano Mazzocchi <st...@apache.org>.
Ulrich Mayring wrote:
>
> Stefano Mazzocchi wrote:
> >
> > Since we are in the middle of a big shift between the 1.7 and 2.0 tree,
> > we don't want to waste time writing docs that we'll be throwing away in
> > a couple of months.
>
> A couple of months? Is that a promise? ;-)
Beta for June, we said.
--
Stefano Mazzocchi One must still have chaos in oneself to be
able to give birth to a dancing star.
<st...@apache.org> Friedrich Nietzsche
--------------------------------------------------------------------
Missed us in Orlando? Make it up with ApacheCON Europe in London!
------------------------- http://ApacheCon.Com ---------------------
Re: XSLT questions.
Posted by Ulrich Mayring <ul...@denic.de>.
Stefano Mazzocchi wrote:
>
> Since we are in the middle of a big shift between the 1.7 and 2.0 tree,
> we don't want to waste time writing docs that we'll be throwing away in
> a couple of months.
A couple of months? Is that a promise? ;-)
Ulrich
--
Ulrich Mayring
DENIC eG, Systementwicklung
Re: XSLT questions.
Posted by Stefano Mazzocchi <st...@apache.org>.
Sebastien Koechlin I-VISION wrote:
>
> Peter Kharchenko wrote :
>
> > I have a couple of rather basic questions on associating XSLT stylesheets with XML
> > documents. I've read the w3c recommendation on that subject
> > (http://www.w3.org/1999/06/REC-xml-stylesheet-19990629/), but couldn't find an
> > answer. I hope one of you guys can help me out.
>
> I did not find any good documentation about XSLT. It's really painful.
> (And it's the same for XSP and taglib, Cocoon is an hard way !)
Since we are in the middle of a big shift between the 1.7 and 2.0 tree,
we don't want to waste time writing docs that we'll be throwing away in
a couple of months.
Anyway, never said learning Cocoon was easy :)
--
Stefano Mazzocchi One must still have chaos in oneself to be
able to give birth to a dancing star.
<st...@apache.org> Friedrich Nietzsche
--------------------------------------------------------------------
Missed us in Orlando? Make it up with ApacheCON Europe in London!
------------------------- http://ApacheCon.Com ---------------------
Re: XSLT questions.
Posted by Sebastien Koechlin I-VISION <sk...@n-soft.com>.
Peter Kharchenko wrote :
> I have a couple of rather basic questions on associating XSLT stylesheets with XML
> documents. I've read the w3c recommendation on that subject
> (http://www.w3.org/1999/06/REC-xml-stylesheet-19990629/), but couldn't find an
> answer. I hope one of you guys can help me out.
I did not find any good documentation about XSLT. It's really painful.
(And it's the same for XSP and taglib, Cocoon is an hard way !)
> I was wondering if it's possible to associate stylesheet with a particular XML node
> instead of a whole document. For example if I have the following document,
> --------------------
> <book>
> <index> ... </index>
> <chapter> ... </chapter>
> <chapter> ... </chapter>
> </book>
> --------------------
> I would like to associate a different stylesheet with each of the <chapter> nodes
> (because chapters might differ in their formats).
You can associate a template with a particular element using XPath using
something
like :
<xsl:template match="book">
(...)
<xsl:apply-templates select="index">
<xsl:apply-templates select="chapter[1]" mode="style1" />
<xsl:apply-templates select="chapter[2]" mode="style2" />
(...)
</xsl:template>
<xsl:template match="chapter" mode="style1">
(...)
</xsl:template>
<xsl:template match="chapter" mode="style2">
(...)
</xsl:template>
With XPath, you can select a particular chapter, on it's position (for
example every other
chapter), or on an chapter attribute (better), using
select="chapter[@style='value']"
--
Seb
Re: XSLT questions.
Posted by Donald Ball <ba...@webslingerZ.com>.
On Mon, 17 Apr 2000, Peter Kharchenko wrote:
> Second question is somewhat similar. I would like to have an XML
> document that includes other XML documents. Does cocoon support
> Xinclude syntax (<xinclude:include href="other.xml"/>) ? And, if so,
> how are the XSLT transformations performed ? If "other.xml" specifies
> its own stylesheet, will it be processed prior to stylesheets
> specified in the main document ?
Not in cocoon 1, only in cocoon2.
- donald