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

Re: Global namespace prefixes (Corrected Examples)

Subject: Re: Global namespace prefixes (Corrected Examples)
From: Nathan Potter <ndp@xxxxxxxxxxxxxxxxxxxx>
Date: Thu, 13 Nov 2008 17:25:36 -0800
Re:  Global namespace prefixes (Corrected Examples)
On Nov 13, 2008, at 4:49 PM, David Carlisle wrote:



Does cause my Xerces XSLT processor to use it, which although I'm
still stuck with all the namespace declarations at least the prefix is
consistent.

as shown you can force the declaration of the prefix on the top level element by sticking a att::foo attribute there, or as Michael showed, making an attribute in a temporary node set variable using exslt:node-set which xalan (not xerces, which is an xml parser) does support, and then copying the namespace node.

I don't understand how to do this thing with node-set. When I try this:



<xsl:variable name="dummy">
<xsl:element name="att:dummy" namespace="{/dap:Dataset/@base}/ att#"/>
</xsl:variable>



<xsl:template match="dap:Dataset" >
<rdf:RDF>
<xsl:copy-of select="exslt:node-set($dummy)// namespace::*"/>
<xsl:apply-templates />
</rdf:RDF>
</xsl:template>


I get a "Namespace prefix 'exslt' is undeclared." error when I compile the stylesheet. Which isn't surprising, since it is missing and I suspect the crux of this trick is in setting the prefix correctly.








<!ENTITY NBSP "<xsl:text disable-output-escaping='yes'>&amp;nbsp;</xsl:text>" >

eek never use d-o-e unless you really need to, and even then don't do it
unless you really really need to. here you coukld just use &#160;
instead of &NBSP; and make the stylesheet a lot more portable and
robust.


Actually that's cruft from another endeavor. It can be removed. (And I tried replacing it in the code that does use it with &#160; and got a bunch of strange characters in my output. What character did you intend?)



<xsl:template match="/dap:Dataset">

<rdf:RDF xml:base="{$XML_BASE}" >

<owl:Ontology

here is where you can add the namespace declation for your att prefix.

Right. I got that.


But I can't follow this last bit:


Note however that I think that xml:base declaration is in error, as
xml:base as well as being an attribute to be copied to the output is an
xml:base attribute which affects the xml parsing of the stylesheet

??? it does?? I don't get it.



and "{$XML_BASE}" isn't a valid URI,

It's not? Works for me... resolves to "http://ndp.opendap.org:8080/opendap/bears.nc " which is the source document that generated all of these derived products.


and even if it were, it isn't th
ebase yu want to use (eg as base URI for any uses of document() )




safer to do <rdf:RDF> <xsl:attribute name="xml:base"><xsl:alue-of select="$XML_BASE"/></xsl;attribute>

so it's added to the result without affecting the stylesheet.


I do see how this produces equivalent output, but I don't see why the thing I had was creating a problem.







David


________________________________________________________________________ The Numerical Algorithms Group Ltd is a company registered in England and Wales with company number 1249803. The registered office is: Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs.
________________________________________________________________________

============================================================ Nathan Potter Oregon State University, COAS ndp at coas.oregonstate.edu 104 Ocean. Admin. Bldg. 541 737 2293 voice Corvallis, OR 97331-5503 541 737 2064 fax

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.