gorillacommunications wrote:
> foo.xml:
> <?xml version="1.0" encoding="UTF-8"?>
> <page>
>  <title>Hello</title>
>  <content>
>   <para>This is my first Cocoon page!</para>
>  </content>
> </page>
> -----------------------------
> foo1.xsl:
> <?xml version="1.0"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
>   <xsl:param name="view-source"/>
>   <xsl:template match="page">
>     <xsl:copy>
>      <xsl:apply-templates/>

Because there are no other templates in the style sheet,
default templates kick in. They just recursively do
xsl:apply-templates for elements and copy text nodes
through. No elements are copied or created, therefore
the output of your first transformation looks like
  <?xml version="1.0" encoding="UTF-8"?>
  <page>
   Hello

    This is my first Cocoon page!

  </page>
If you want to copy through elements and attributes, you'll
have to define a copy template explicitely:
   <xsl:template match="node()|@*">
     <xsl:copy>
        <xsl:apply-templates select="node()|@*"/>
     </xsl:copy>
   </xsl:template>

This is actually one of the XSLT FAQs.

J.Pietschmann



---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>

Reply via email to