This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: deep "copy-of" a source fragment


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]