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

Re: accessing xsl document root from an included styl

Subject: Re: accessing xsl document root from an included stylesheet
From: Jan Bilik <jan.bilik.w@xxxxxxxxx>
Date: Fri, 4 Dec 2009 15:18:15 +0100
Re:  accessing xsl document root from an included  styl
2009/12/4 Michael Kay <mike@xxxxxxxxxxxx>:
> It's both verbose and inefficient compared with the much simpler
> <xsl:variable name="xslmyn" select="document('')/*/namespace::myn" />

Thanks ! I'll fix this.

> (..) But there's no way of disovering in an
> included module where it was included from.

I read on w3c.org that "the resource located by the href attribute
value is parsed as an XML document, and the children of the
xsl:stylesheet element in this document replace the xsl:include
element in the including document."
Thus I thought the included code could access namespaces aliases of
the main xsl:stylesheet element. Anyway, I was clearly wrong.

> However, it all seesm very long-winded to me. Why don't you just do
> <xsl:template match="/">
>  <xsl:if test="not(myn:rootElement)">
>     <xsl:message terminate="yes">Root element must be named myn:rootElement
> in the correct namespace</xsl:message>

I think I can not use this alternative, as my grammar is not the main
one : it defines additional attributes and elements that expand the
base grammars (to be clear : XSD and WADL are the base grammars).
Thus, I have no idea of what is the root element, which grammar it
fits, etc. In fact, I know it for *each* of my XSLs, of course, but
not in my case, as I was looking for a generic template to check the
namespace version.

Thanks a lot for your detailed answer and advice, Michael.



> Regards,
> Michael Kay
> http://www.saxonica.com/
> http://twitter.com/michaelhkay

Current Thread


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.
First Name
Last Name
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.