On Monday, July 1, 2002, at 11:15  AM, Reinhard Poetz wrote:

> Thank you Harry and Manos!
>
> I want to provide a summary of this thread - maybe this could be 
> included
> into some docs.

Ok, sounds like an FAQ that points to a new Snippet (i.e. content below 
too long for basic FAQ).

We need four doc patches:
1. patch for FAQ: src/documentation/xdocs/faq/faq-xslt.xml
    (add question then short answer with link to Snippet)
2. patch for a new snippet file, i.e.
      src/documentation/xdocs/snippet/snippet-remove-namespaces.xml (with 
content and snippets below)
3. patch for src/documentation/xdocs/snippet/book.xml (side menu link to 
Snippet)
4. patch for src/documentation/xdocs/snippet/index.xml (title and link 
to snippet)

Any takers?

  -- Diana


>
> Problem:
> ********
>
>  ... I use namespaces and I want to remove them in my result xml ...
>
> (original mail:
> http://marc.theaimsgroup.com/?l=xml-cocoon-users&m=102551958020786&w=2)
>
>
> Solutions, which NOT work:
> **************************
> exclude-result-prefixes (in the stylesheet)
> [http://marc.theaimsgroup.com/?l=xml-cocoon-users&m=100101165325379&w=2]
>
> <omit-xml-declaration> (in the sitemap)
> [http://marc.theaimsgroup.com/?l=xml-cocoon-users&m=100084611731795&w=2]
>
> exclude-prefixes (in the stylesheet)
> http://marc.theaimsgroup.com/?l=xml-cocoon-users&m=101912408904652&w=2
>
>
>
> Solutions, which WORK:
> **********************
>
> 1.)
> Harry Lai:
> ----------
> Kay's XSLT Programmer's Reference:
> "The xsl:exclude-result-prefixes and exclude-result-prefixes attributes
> apply only to namespace nodes copied from the stylesheet using literal
> result elements.  They do not affect namespace nodes copied from
> the source document using <xsl:copy> or <xsl:copy-of>: there is no way
> of suppressing these."
>
> Unfortunately, since xslt's will often have a catch-all template
> matcher to copy elements it doesn't transform, this comes up quite a 
> bit.
>
> So... what I ended up doing was extending the HTMLSerializer (or 
> whatever
> serializer you're using for your pipelines), and overriding the
> startPrefixMapping and endPrefixMapping methods to do nothing, 
> effectively
> removing all namespaces from my HTML.  This also had the added benefit 
> of
> having no performance penalties (and theoretically, a
> ever-so-slight speedup since we no longer process namespaces in our
> serializer).
>
> You could make this more general, and use the serializer's
> configuration to declare which namespaces you want to exclude, but 
> excluding
> all
> worked well for us, especially since we were outputting HTML.
>
> (complete mail:
> http://marc.theaimsgroup.com/?l=xml-cocoon-users&m=102553525402606&w=2)
>
> 2.)
> Manos Batsis:
> -------------
> <?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>
>
> (complete mail:
> http://marc.theaimsgroup.com/?l=xml-cocoon-users&m=102552029221254&w=2)
>
> Regards,
> Reinhard
>
>
> ---------------------------------------------------------------------
> Please check that your question  has not already been answered in the
> FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
>
> To unsubscribe, e-mail:     <[EMAIL PROTECTED]>
> For additional commands, e-mail:   <[EMAIL PROTECTED]>
>


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

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

Reply via email to