cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nele Vogel" ...@sevencs.com>
Subject Re: content aggregation + links to used files
Date Wed, 07 Jan 2004 11:26:26 GMT
Hello!

I changed my stylesheet news.xsl as Joerg suggested using prefixed
matching, but unfortunately it still doesn't work.

In my pipeline I use a directory generator to process all files. The
output belongs to the namespace
xmlns:dir="http://apache.org/cocoon/directory/2.0".

<dir:directory name="news">
  <dir:file name="news0.xml"/>
  <dir:file name="news1.xml"/>
</dir:directory>
(Note: I deleted some attriubtes.)

The stylesheet cincludeFiles.xsl uses prefixed matching - its the same
kind of problem, isn't it? This template matches as expected, the one in
news.xsl doesn't.

  <xsl:template match="dir:file">
    <xsl:param name="path"/>
    <xsl:element name="file">
      <xsl:attribute name="path">
        <xsl:value-of select="concat($path,./@name)"/>
      </xsl:attribute>
      <cinclude:include src="{concat($path,./@name)}"/>
    </xsl:element>
  </xsl:template>

When I remove all namespaces as Nicolas advised, it works.

Thank you for your help,
Nele

> Well, in that case it is b/c the ouput must be namespace less if I remember
> right
> Le Mercredi 07 Janvier 2004 02:13, Joerg Heinicke a écrit :
>> I don't think, simply removing all namespaces is a good solution,
though the namespace might not be needed here. Furthermore this
approach slows down the processing through an additional transformer
step where it is not necessary.
>>
>> Her problem is the output of cincludeFiles.xsl in the default
namespace. Matching on such elements has to be done in XSLT prefixed,
i.e. the namespace must be bound to a prefix and then these elements
can be matched. So the news.xsl has to be something like the following:
>>
>> <xsl:stylesheet version="1.0"
>>      xmlns="http://www.sevencs.com"
>>      xmlns:s="http://www.sevencs.com"
>>      xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>>
>> ...
>>
>>    <xsl:template match="s:file">
>>      <xsl:text>following file was added:</xsl:text>
>>      <xsl:value-of select="./@path"/>
>>    </xsl:template>
>>
>> </xsl:stylesheet>
>>
>> It's an XSLT FAQ and more about it can be found here:
>> http://www.dpawson.co.uk/xsl/sect2/N5536.html#d5360e970.
>>
>> Joerg
>>
>> On 05.01.2004 16:04, Nicolas Toper wrote:
>> > In that case use that in another transformer: it'll remove all NS
from the XML
>> >
>> > <?xml version="1.0" encoding="UTF-8"?>
>> > <xsl:stylesheet version="1.0"
>> > xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>> >   <xsl:output method="xml" version="1.0" encoding="UTF-8"
>> indent="yes"/>
>> >     <xsl:template match="*">
>> >       <!-- remove element prefix (if any) -->
>> >       <xsl:element name="{local-name()}">
>> >         <!-- process attributes -->
>> >         <xsl:for-each select="@*">
>> >           <!-- remove attribute prefix (if any) -->
>> >           <xsl:attribute name="{local-name()}">
>> >             <xsl:value-of select="."/>
>> >           </xsl:attribute>
>> >         </xsl:for-each>
>> >         <xsl:apply-templates/>
>> >
>> >       </xsl:element>
>> >   </xsl:template>
>> > </xsl:stylesheet>
>>
>> ---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
> --------------------------------------------------------------------- To
unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
>




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


Mime
View raw message