|
[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
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








