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

RE: [saxon] Re: Saxon v7.9.1: Superfluous xmlns attri

Subject: RE: [saxon] Re: Saxon v7.9.1: Superfluous xmlns attributes in res ult
From: "Mullee, John" <john_mullee@xxxxxxxxx>
Date: Fri, 7 May 2004 13:56:37 -0400
saxon xmlns
Aha! Thanks very much.
(note the FAQ is entirely xslt-1, though it's a great starting point..)
Adjusted code below works great..
john

<!--
INPUT:
   <?xml version="1.0" encoding="utf-8" ?>
   <dx:article
      xmlns="http://www.w3.org/1999/xhtml"
      xmlns:dx="http://www.araxis.com/2000/DocXml">
      <p>
      <strong>Text<dx:other id="5"/> <em>in</em> source document</strong>
      </p>
   </dx:article>

OUTPUT:
   SAXON 7.9.1 from Saxonica

   <?xml version="1.0" encoding="US-ASCII"?>
   <html xmlns="http://www.w3.org/1999/xhtml">
      <body>
         <p>Some text</p>
         <p>
            <strong>Text <em>in</em> source document</strong>
         </p>
      </body>
   </html>
-->
<xsl:stylesheet
   version="2.0"
   xmlns="http://www.w3.org/1999/xhtml"
   xpath-default-namespace="http://www.w3.org/1999/xhtml"

   xmlns:xhtml="http://www.w3.org/1999/xhtml"
   xmlns:dx="http://www.araxis.com/2000/DocXml"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   exclude-result-prefixes="#default"
   >

   <xsl:output method="xml" indent="yes" encoding="US-ASCII" />

   <xsl:template match="em"><em><xsl:apply-templates/></em></xsl:template>
   <xsl:template
match="strong"><strong><xsl:apply-templates/></strong></xsl:template>
   <xsl:template match="p"><p><xsl:apply-templates/></p></xsl:template>

   <xsl:template match="dx:article">
      <xsl:variable name="html">
         <html dx:ignore="this">
            <body>
               <dx:element><p>Some text</p></dx:element>
               <xsl:apply-templates />
            </body>
         </html>
      </xsl:variable>
      <xsl:apply-templates select="$html" mode="only-default-namespace"/>
   </xsl:template>

   <xsl:template match="node()|@*" mode="only-default-namespace">
      <xsl:choose>
         <xsl:when test="compare(local-name(), name())=0">
            <xsl:copy copy-namespaces="no">
               <xsl:apply-templates select="@*|node()"
mode="only-default-namespace"/>
            </xsl:copy>
         </xsl:when>
         <xsl:otherwise>
            <xsl:apply-templates select="node()"
mode="only-default-namespace"/>
         </xsl:otherwise>
      </xsl:choose>
   </xsl:template>

</xsl:stylesheet>


> -----Original Message-----
> From: saxon-help-admin@xxxxxxxxxxxxxxxxxxxxx
> [mailto:saxon-help-admin@xxxxxxxxxxxxxxxxxxxxx]On Behalf Of 
> Michael Kay
> Sent: 07 May 2004 17:20
> To: saxon-help@xxxxxxxxxxxxxxxxxxxxx

> This one is a FAQ: your <p> element is in the namespace
> http://www.w3.org/1999/xhtml, so you need to specify xhtml:p 
> in any pattern
> or path expression, where xhtml is bound to that namespace URI.
> Alternatively in XSLT 2.0 you can specify 
> xpath-default-namespace in the
> xsl:stylesheet element. 
> 
> Michael Kay  


------------------------------------------------------------------------------
Notice:  This e-mail message, together with any attachments, contains
information of Merck & Co., Inc. (One Merck Drive, Whitehouse Station, New
Jersey, USA 08889), and/or its affiliates (which may be known outside the
United States as Merck Frosst, Merck Sharp & Dohme or MSD and in Japan as
Banyu) that may be confidential, proprietary copyrighted and/or legally
privileged. It is intended solely for the use of the individual or entity
named on this message.  If you are not the intended recipient, and have
received this message in error, please notify us immediately by reply e-mail
and then delete it from your system.
------------------------------------------------------------------------------

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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

Buy Stylus Studio Now

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-2013 All Rights Reserved.