xsl-list
[Top] [All Lists]

Re: Problem copying xhtml elements from xml source

2004-07-13 08:16:55
Thanks!! That solves the problem

and now I'm beginning to better understand the mechanisms of namespaces

The solution suggested by Josh Canfield also works
('manual copy' to an <xsl:element name="{local-name()}">)
in fact I had already implemented this as a workaround, and
it even works with {name()} instead of {local-name()}
(I guess because the xhtml namespace prefix in the stylesheet
is empty, anyway)


----- Original Message ----- 
From: "David Carlisle" <davidc(_at_)nag(_dot_)co(_dot_)uk>
To: <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
Sent: Tuesday, July 13, 2004 11:18 AM
Subject: Re: [xsl] Problem copying xhtml elements from xml source



If you can control your input you would be better to fix your input so
it uses XHTML not elements in no-namespace that have the same local
names as XHTML elements, so use

<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet type="text/xsl" href="test-copy-of.xsl"?>
<test-copy-of>
  <div xmlns="http://www.w3.org/1999/xhtml";>
  <p style="color:red;">a paragraph in <b>red</b></p>
  <p><img src="wood102.jpg" width="149" height="177" alt="wood"/></p>
  </div>
</test-copy-of>

then your copy-of will work and everything will be fine.

Otherwise you need to change the namespace of every element, to XSLT
this is changing the name, like changing <a> to <b> so  you can do it,
but not with xsl:copy-of or xsl:copy.

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

--+------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--