[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: How to remove the namespace in the output tags

Subject: Re: How to remove the namespace in the output tags
From: "Mukul Gandhi" <gandhi.mukul@xxxxxxxxx>
Date: Wed, 3 Oct 2007 22:32:33 +0530
Re:  How to remove the namespace in the output tags
I think you received answer to this question earlier. I strongly
suggest, please don't use 1.1 dialect of XSLT (even if the product you
are using supports it). XSLT 1.1 never became a W3C recommendation,
and the development on it didn't went beyond the draft stage. You
should use either XSLT 1.0 or XSLT 2.0, because both are W3C
recommendations.

Here is a XSLT 1.0 solution for this problem:

<xsl:stylesheet version="1.0"
 	       xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	       xmlns:xhtml="http://www.w3.org/1999/xhtml"
 	       exclude-result-prefixes="xhtml">

 <xsl:template match="NewsML">
   <story_text>
     <xsl:for-each select="ContentItem/DataContent/xhtml:html/xhtml:body/*">
       <xsl:element name="{local-name()}">
         <xsl:apply-templates />
       </xsl:element>
     </xsl:for-each>
   </story_text>
 </xsl:template>

</xsl:stylesheet>


On 10/3/07, Thangavelu Srinivasan <vasantry@xxxxxxxxx> wrote:
> Hi Folks
>
> INPUT:
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE NewsML SYSTEM "http://idsdat06.reuters.com/newsml/NewsMLv1.0.dtd" [
>  <!ENTITY % xhtml SYSTEM
> "http://idsdat06.reuters.com/newsml/xhtml1-strict.dtd">
>  %xhtml;
> ]>
> <NewsML Duid="165_NEWSML">
> <ContentItem>
> <DataContent>
>  <html xmlns="http://www.w3.org/1999/xhtml">
>  <head>
>  <title/>
>  </head>
>  <body>
>  <p>  (Adds company news, index futures and analyst comment)</p>
>  <p> Early signs of improving confidence in the markets were crushed by comments
> from Countrywide Financial &lt;CFC.N&gt; Chief Executive Angelo
> Mozilo, who said on
> Thursday the housing downturn could drag the U.S. economy into recession.</p>
>  <p> New home sales data at 1400 GMT may provide further clues about
> the state of
> the housing sector. Click on [ID:nN22401142]</p>
>  <p> For related news, double click on [BASF.DE-E]</p>
>  </body>
>  </html>
> </DataContent>
> </ContentItem>
> </NewsML>
>
>
> My XSL:
>
> <xsl:stylesheet version="1.1"
>  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>  xmlns:str="http://exslt.org/strings"
>  xmlns:xhtml="http://www.w3.org/1999/xhtml"
>  xmlns:libxslt="http://xmlsoft.org/XSLT/namespace"
>  exclude-result-prefixes="xhtml">
>  <xsl:template match="NewsML">
> <story_text deepcopy='yes'><xsl:copy-of
> select="ContentItem/DataContent/xhtml:html/xhtml:body/*"/></story_text>
> </xsl:template>
> </xsl:stylesheet>
>
>
>
> OUTPUT:
>
> <story_text><p xmlns="http://www.w3.org/1999/xhtml">  (Adds company
> news, index futures and analyst comment)</p>
>  <p xmlns="http://www.w3.org/1999/xhtml"> Early signs of improving
> confidence in the markets were crushed by comments
> from Countrywide Financial &lt;CFC.N&gt; Chief Executive Angelo
> Mozilo, who said on
> Thursday the housing downturn could drag the U.S. economy into recession.</p>
>  <p xmlns="http://www.w3.org/1999/xhtml"> New home sales data at 1400
> GMT may provide further clues about the state of
> the housing sector. Click on [ID:nN22401142]</p>
>  <p xmlns="http://www.w3.org/1999/xhtml"> For related news, double
> click on [BASF.DE-E]</p></story_text>
>
>
> Question:
>
> How to remove the namespace from the p tags for the output through
> XSL. Is there any syntax error in XSL.
>
> Any suggestions are welcome
>
> Thanks and Regards
> Srinivas


-- 
Regards,
Mukul Gandhi

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Cast Your Vote

We need your help – Vote for DataDirect XML Products!

  • Best SOA or XML site

Winners and finalists announced at SOA World Conference in November.

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.