tiago,
there's nothing really strange with this. select is fully supported on
apply-templates. however you are trying to select "item" children of the
root node which only has one child, named "rdf:RDF". when you remove the
select attribute, this child gets processed implicitly, which means that
its children are processed one by one (this is the default rule) and
that's why your second template catches them.
hope this helps,
tom
[EMAIL PROTECTED] wrote:
>
> While applying the following to an rdf format. (for example
> http://slashdot.org/slashdot.rdf)
>
> <?xml version="1.0"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>
> <xsl:template match="/">
> <xsl:apply-templates select="item" />
> </xsl:template>
>
> <xsl:template match="item">
> title:<xsl:value-of select="title" />
> link:<xsl:value-of select="link" />
> </xsl:template>
>
> </xsl:stylesheet>
>
> -------------
> I get (only) <?xml version="1.0" encoding="UTF-8"?>
>
> It seems to me (the documentation says otherwise) that select is not
> supported yet in apply-templates because if i remove the select it works
> (not as expected though, will talk about that later). Is select not
> supported yet?
>
> --------- excerpt from slashdot.rdf
> <?xml version="1.0"?><rdf:RDF
> xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
> xmlns="http://my.netscape.com/rdf/simple/0.9/">
>
> <channel>
> <title>Slashdot:News for Nerds. Stuff that Matters.</title>
> <link>http://slashdot.org/</link>
> <description>News for Nerds. Stuff that Matters</description>
> </channel>
>
> <image>
> <title>Slashdot</title>
> <url>http://slashdot.org/images/slashdotlg.gif</url>
> <link>http://slashdot.org</link>
> </image>
>
> <item>
> <title>World's Biggest Roller Coaster</title>
> <link>http://slashdot.org/articles/99/07/23/1722251.shtml</link>
> </item>
>
> [.... snip.....]
>
> [multiple item ommited ]
>
> -------------
>
> if i apply the stylesheet above, i get
>
> <?xml version="1.0" encoding="UTF-8"?>
>
>
> Slashdot:News for Nerds. Stuff that Matters.
> http://slashdot.org/
> News for Nerds. Stuff that Matters
>
>
>
> Slashdot
> http://slashdot.org/images/slashdotlg.gif
> http://slashdot.org
>
>
>
> World's Biggest Roller Coaster
>
> ....
> ....
>
> ------------------------------
>
> Which is kind of strange to me. Why channel and image element are being
> rendered???. If want to render item types only, i have 2 choices:
>
> Using select in apply-templates (which doesn't work)
> define an empy channel and image template. Which is cumbersome since it is
> not practical to define a template for each element type we do not wish to
> render. (which kinda defeats one of XML purposes that is to be extensible.
>
> (or perhaps i've misunderstood XSLT completely??
>
> -------------------------------
> Is this a correct behaviour?? (it seems to me it is not)
>
> Assume such a file:
>
> ----- simple.xml
> <?xml version="1.0"?>
> <root>
> <main>
> main content
>
> <subElement>subelement content</subElement>
> </main>
>
> <main>
> main content2
> </main>
> </root>
> ----- simple.xsl
> <?xml version="1.0"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>
> <xsl:template match="/">
> <xsl:apply-templates />
> </xsl:template>
>
> <xsl:template match="main">
> main template:<xsl:value-of select="subElement" />
> <xsl:apply-templates />
> </xsl:template>
>
> </xsl:stylesheet>
>
> ------ partial result
> main template:subelement content
> main content
>
> subelement content
> ..
> ..
> ------
> why is main content rendered after the main template?? (it seems obvious
> that is because of <xsl:apply-templates /> inside the main template, but
> wasn't main template only supposed to have access to the elements (and
> content) inside main tags (not main tag content which cannot be parent of
> itself??))
>
> thanks.
>
> --
> Tiago Pascoal ([EMAIL PROTECTED]) FAX : +351-1-7273394
> Politicamente incorrecto, e membro (nao muito) proeminente da geracao rasca.
> Recem empossado (engajado) cidadao da republica das bananas.
>
> "Reality is that which, when you stop believing in it, doesn't go away".
> [Philip K. Dick]