Subject: [xsl] Can I change the namespace of elements included via document()? From: Graham Hannington <Ghannington@xxxxxxx> Date: Mon, 2 Jun 2003 16:09:44 +0100 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Create table with optiona, Ricardo Saraiva | Thread | Re: [xsl] Can I change the namespac, David Carlisle |
Re: [xsl] RE: adding link to report, G. Ken Holman | Date | RE: [xsl] RE: adding link to report, Sawyer, Larry |
Month |