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

Can I change the namespace of elements included via do

Subject: Can I change the namespace of elements included via document()?
From: Graham Hannington <Ghannington@xxxxxxx>
Date: Mon, 2 Jun 2003 16:09:44 +0100
how to change the namespace
I'm not sure the subject line is the best way to phrase this question.

Here's what I'm trying to do.

In my XHTML files, I have elements like this:

<div class="reuse">some_id</div>

(Please don't ask me why I didn't make some_id an attribute!)

I have a separate XML file called reusable.xml that looks like this:

	<entities xmlns="http://www.w3.org/1999/xhtml">
		<entity id="some_id">
			<p>Some HTML <code>tags</code> that might be needed
several times, so I create a reusable <q>entity</q>.</p>
		</entity>
	...
	</entities>

To create a PDF out of my XHTML files, I'm using a customized version of the
Antenna House xhtml2fo.xsl.

To include the "reusable" entities, I use:

	<!-- Insert span.reuse and div.reuse content -->
	<xsl:template match="html:span[@class = 'reuse'] | html:div[@class =
'reuse']">
		<xsl:variable name="entity"
select="normalize-space(string(.))" />

		<xsl:apply-templates select="document('reusable.xml',
.)//html:entity[@id = $entity]" />

	</xsl:template>

This means I have to have an xmlns="http://www.w3.org/1999/xhtml" attribute
on the <entities> element in reusable.xml.

I'd much rather do without this xmlns attribute.  However, the rest of
xhtml2f0.xsl contains templates for matching "html:p" and "html:code" (where
the <xsl:stylesheet> element has the attribute
xmlns:html="http://www.w3.org/1999/xhtml").

Is there any way to bring the selected <entity> tag into the "html"
namespace "on the fly", so that the existing "html:p" templates will work,
without having to have that rather (to me) ugly
xmlns="http://www.w3.org/1999/xhtml" attribute on the <entities> element in
reusable.xml?

Removing the xmlns attribute from the <entities> element would also save me
grief in XSLT processing for Web/.chm.

Graham Hannington

 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.