[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[xsl] RE: [saxon] Re: Saxon v7.9.1: Superfluous xmlns attributes in res ult
Subject: [xsl] 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 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Parameters in the XPath f, Christopher Hearns | Thread | [xsl] NullPointerException with Jav, Barry Lay |
Re: [xsl] Parameters in the XPath f, David Carlisle | Date | [xsl] NullPointerException with Jav, Barry Lay |
Month |