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

Re: deep "copy-of" a source fragment

Subject: Re: deep "copy-of" a source fragment
From: Terence Kearns <terencek@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 05 Sep 2002 15:47:42 +1000
.net deep copy
Dave, you rock the house, baby!

I had actually tried the namespace declaration before but I had gotten it wrong.

The HTML Tidy program outputs an [unqualified?] xmlns attribute (declaration) in the <html> root element so the namespace is "html". When I declared this in my the <xsl:stylesheet> root element *as you suggested* then xalan knew what the hell I was refering to by html:body and then behaved as expected.

The source document element looks like this...
<html xmlns="http://www.w3.org/1999/xhtml">

My stylesheet looks like this:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:html="http://www.w3.org/1999/xhtml">
    <xsl:template match="/">
        <xsl:copy-of select="/html:html/html:body/node()"/>
    </xsl:template>
</xsl:stylesheet>

I was careful to get an exact match on the URI for the namespace declarations between the source document and the stylesheet. **


QUESTION(S):
what is the deal with "where" you declare the namespace? Does it matter?
Must I do all my declarations in the root element?
If not, must I do all my declarations in the root stylesheet element if I want the XSL processor to match against them?




** My only concern is that if for whatever reason the namespace declaration changes, it will [silently] "break" my XSL templates. So maybe I will take the easy way out and suppress namespace declarations in my xhtml source reducing it to an anonymous well-formed document which is xhtml by convention (rather than validity).


David Carlisle wrote:
match="/html/body/"


probably there are no elements called html or body Tidy probably wrote th eelements in the xhtml namespace. A namespace is
part of teh name of an element, so you'll need


match="/h:html/h:body/"

and xmlns:h="http://www.w3.org/1999/xhtml" to declare the h prefix on
your xsl:stylesheet element.

David

_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp or alternatively call
Star Internet for details on the Virus Scanning Service.

XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list


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.