XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] RE: Namespace use cases


On Jul 11, 2009, at 8:08 AM, Sean McGrath wrote:
> Anyway, I have a trick I use every day for namespaced XML processing  
> and I strongly recommend it
> to everyone : mask them.
>
> Start your processing pipelines by masking the namespaces. E.g.
>
> transform this:
>   <h:table xmlns:h="http://www.w3.org/TR/html4/";>
>
> to this:
>   <h_table xmlns_h="http://www.w3.org/TR/html4/";>
>
> Now, go about your business processing the data and when you are ready
> to re-serialize to disk, do the transform in reverse. E.g.
>
> transform this:
>   <h_table xmlns_h="http://www.w3.org/TR/html4/";>
> to this:
>   <h:table xmlns:h="http://www.w3.org/TR/html4/";>
>
> Obviously, I don't do it prefix by prefix. I use utilities that  
> transform all prefixes and all namespace
> declarations.
>
> It works a treat:-)

Maybe I am missing the utility of this because of too simple an  
example, but why would you do this?

Why not use an identity transformation on things in the HTML namespace?

Why is it better to remove the ability to match at the namespace level?

<xsl:template match="@*|h:*">
   <xsl:copy>
     <xsl:apply-templates select="@*"/>
     <xsl:apply-templates/>
   </xsl:copy>
</xsl:template>

?
-Rob



>
> Sean
> http://seanmcgrath.blogspot.com




[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS