it's because as soon as you use a ns in your xml document, the xsl spec says
that an unnommed xml tag refers to the default ns.
So basically:
<root xmlns:ns="ns" xmlns:"ns2">
<ns2:one>
<two>
</...>
two has actually ns as ns bc it is the default ns for this subsection of this
xml doc
Le Lundi 05 Janvier 2004 17:06, Nele Vogel a �crit :
> Hi Nicolas!
>
> I used your suggestion and removed all namespaces from the XML stream: The
> XSL transform actually outputs the correct values. Can you please explain
> to me, why this approach works?
>
> Thank you very much for your help!
> Nele
>
> Nicolas 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>
> >
> >> Nicolas wrote:
> >> > If I understand everything: you want a big XML files like that:
> >> > <root>
> >> > <news>
> >> > <file path="news/news1.xml">
> >> > <article>
> >> > [...]
> >> > </article>
> >> > </file>
> >> > </news>
> >> >
> >> > <news>
> >> > <file path="news/news1.xml">
> >> > <article>
> >> > [...]
> >> > </article>
> >> > </file>
> >> > </news>
> >> > </root>
> >>
> >> It should look like this:
> >>
> >> <root>
> >> <news>
> >>
> >> <file path="news/news1.xml">
> >> <article>
> >> [...]
> >> </article>
> >> </file>
> >>
> >> <file path="news/news2.xml">
> >> <article>
> >> [...]
> >> </article>
> >> </file>
> >>
> >> </news>
> >> </root>
> >>
> >> > And your problem is the XML file generated is transformed badly?
> >>
> >> Yes, exactly. Koen and Simon pointed out, it might be a namespace
> >> problem.
> >>
> >> Thanks a lot for your help!
> >> Nele.
> >>
> >> >> Nicolas wrote:
> >> >> > it depends on which information you need exactly: the name of the
> >> >>
> >> >> file:
> >> >> > put it as a parameter into the URL and pass it to the XSL
> >> >>
> >> >> I need the path (relative or absolute) to the processed file.
> >> >>
> >> >> I am able to extract the relative path inside the first XSL transform
> >> >> (cincludeFiles.xsl):
> >> >>
> >> >> <xsl:template match="dir:directory">
> >> >> <xsl:param name="path"/>
> >> >> <xsl:apply-templates>
> >> >> <xsl:with-param name="path">
> >> >> <xsl:value-of select="concat($path,./@name,'/')"/>
> >> >> </xsl:with-param>
> >> >> </xsl:apply-templates>
> >> >> </xsl:template>
> >> >>
> >> >>
> >> >> <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>
> >> >>
> >> >> The output looks like this:
> >> >>
> >> >> <news>
> >> >> <file path="news/news1.xml">
> >> >> <article>
> >> >> [...]
> >> >> </article>
> >> >> </file>
> >> >> </news>
> >> >>
> >> >> The path inside element <file> is correct.
> >> >>
> >> >> However, when I try to process the XML stream for a second time, the
> >> >> templates within "content2page.xsl" neither match element <news> nor
> >> >> element <file>. Why?
> >> >>
> >> >> Thank you for your help, Nicolas!
> >> >> Nele
> >> >>
> >> >> >> Nicolas wrote:
> >> >> >> > If the orginal docs aren't XML you should have a look at
> >>
> >> Chaperon
> >>
> >> >> >> The original documents are also XML documents.
> >> >> >>
> >> >> >> My problem is linking an element with the file it originates from.
> >> >> >> Is it possible to store the information the directory generator
> >> >>
> >> >> extracts
> >> >>
> >> >> >> about my directory structure - maybe as a file?
> >> >> >>
> >> >> >> Thank you for your response!
> >> >> >> Nele.
> >> >> >>
> >> >> >> >> Hi all!
> >> >> >> >>
> >> >> >> >> I want to create an xml document by extracting
> >> >> >> >> defined elements from files conforming to a
> >> >> >> >> known format. When assembling the document I need
> >> >> >> >> to keep in mind which element originates from
> >> >> >> >> which file to be able to link the element with
> >> >> >> >> the corresponding file after transformation into
> >> >> >> >> HTML. The resulting HTML document consists - among
> >> >> >> >> other things - of links to all processed files.
> >> >> >> >>
> >> >> >> >> How do I achieve this with Cocoon?
> >> >> >> >>
> >> >> >> >> All suggestions will be appreciated!
> >> >> >> >> Thanks in advance,
> >> >> >> >> Nele.
> >> >> >> >>
> >> >> >> >>
> >> >> >> >> I tried the following using a directory generator
> >> >> >> >> and aggregation, but it doesn't work.
> >> >> >> >>
> >> >> >> >> +-----------------------------------------+
> >> >> >> >>
> >> >> >> >> | directories within COCOON context |
> >> >> >> >>
> >> >> >> >> +-----------------------------------------+
> >> >> >> >> +---myContentDir/
> >> >> >> >> +---file1.xml
> >> >> >> >> +---file2.xml
> >> >> >> >> +---file3.xml
> >> >> >> >>
> >> >> >> >>
> >> >> >> >> I aggregate the files in "myContentDir" using the
> >> >> >> >> following sitemap snippet:
> >> >> >> >>
> >> >> >> >> +-----------------------------------------+
> >> >> >> >>
> >> >> >> >> | sitemap snippet |
> >> >> >> >>
> >> >> >> >> +-----------------------------------------+
> >> >> >> >> <map:match pattern="content">
> >> >> >> >> <map:generate src="/myContentDir" type="directory">
> >> >> >> >> <map:parameter name="depth" value="1"/>
> >> >> >> >> </map:generate>
> >> >> >> >> <map:transform src="cincludeFiles.xsl">
> >> >> >> >> <map:parameter name="part" value="content"/>
> >> >> >> >> </map:transform>
> >> >> >> >> <map:transform type="cinclude"/>
> >> >> >> >> <map:transform src="content2page.xsl"/>
> >> >> >> >> <map:serialize type="xml"/>
> >> >> >> >> </map:match>
> >> >> >> >>
> >> >> >> >>
> >> >> >> >> Within the stylesheet "cincludeFiles.xsl", I transform the
> >> >> >> >> xml stream coming from the directory generator. Iteratively
> >> >> >> >> all files are inserted by <cinclude:include src="{$path}"/>.
> >> >> >> >> An element named "file" with an attribute "path" is created.
> >> >> >> >>
> >> >> >> >> +-----------------------------------------+
> >> >> >> >>
> >> >> >> >> | stylesheet snippet "cincludeFiles.xsl" |
> >> >> >> >>
> >> >> >> >> +-----------------------------------------+
> >> >> >> >> <xsl:template match="dir:file">
> >> >> >> >> <xsl:param name="path"/>
> >> >> >> >> <xsl:element name="file">
> >> >> >> >> <xsl:attribute name="path">
> >> >> >> >> <xsl:value-of select="$path"/>
> >> >> >> >> </xsl:attribute>
> >> >> >> >> <cinclude:include src="{$path}"/>
> >> >> >> >> </xsl:element>
> >> >> >> >> </xsl:template>
> >> >> >> >>
> >> >> >> >>
> >> >> >> >> The transform outputs the following
> >> >> >> >> ([...] stands for more xml elements):
> >> >> >> >>
> >> >> >> >> [...]
> >> >> >> >> <file path="myContentDir/file1.xml">[...]</file>
> >> >> >> >> <file path="myContentDir/file2.xml">[...]</file>
> >> >> >> >> <file path="myContentDir/file3.xml">[...]</file>
> >> >> >> >> [...]
> >> >> >> >>
> >> >> >> >>
> >> >> >> >> +-----------------------------------------+
> >> >> >> >>
> >> >> >> >> | stylesheet snippet "content2page.xsl" |
> >> >> >> >>
> >> >> >> >> +-----------------------------------------+
> >> >> >> >> <xsl:template match="file">
> >> >> >> >> <xsl:text>following file was added:</xsl:text>
> >> >> >> >> <xsl:value-of select="./@path"/>
> >> >> >> >> </xsl:template>
> >> >> >> >>
> >> >> >> >> When I try to read the attribute value "path", my
> >> >> >> >> stylesheet outputs nothing.
> >> >> >> >>
> >> >> >> >> <xsl:template match="@path">
> >> >> >> >> <xsl:text>following file was added:</xsl:text>
> >> >> >> >> <xsl:value-of select="."/>
> >> >> >> >> </xsl:template>
> >> >> >> >>
> >> >> >> >> Doesn't work either.
> >> >> >> >>
> >> >> >> >> This is really urgent. Thanks for your help!
> >> >> >> >>
> >> >> >> >>
> >> >> >> >>
> >> >> >> >> ---------------------------------------------------------------
> >> >> >> >>--- --- To unsubscribe, e-mail:
> >> >> >> >> [EMAIL PROTECTED]
> >>
> >> For
> >>
> >> >> >> >> additional commands, e-mail: [EMAIL PROTECTED]
> >> >> >> >
> >> >> >> > ----------------------------------------------------------------
> >> >> >> >--- -- To unsubscribe, e-mail:
> >> >> >> > [EMAIL PROTECTED]
> >>
> >> For
> >>
> >> >> >> > additional commands, e-mail: [EMAIL PROTECTED]
> >> >> >>
> >> >> >> ------------------------------------------------------------------
> >> >> >>--- To unsubscribe, e-mail: [EMAIL PROTECTED] For
> >> >> >> additional commands, e-mail: [EMAIL PROTECTED]
> >> >> >
> >> >> > -------------------------------------------------------------------
> >> >> >-- To unsubscribe, e-mail: [EMAIL PROTECTED] For
> >> >> > additional commands, e-mail: [EMAIL PROTECTED]
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >> >
> >> > ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> > For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]