[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Re: [xsl] accessing xsl document root from an included stylesheet
Subject: Re: [xsl] accessing xsl document root from an included stylesheet From: Jan Bilik <jan.bilik.w@xxxxxxxxx> Date: Fri, 4 Dec 2009 15:18:15 +0100 |
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, Jan > > Regards, > > Michael Kay > http://www.saxonica.com/ > http://twitter.com/michaelhkay
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] accessing xsl document ro, Michael Kay | Thread | Re: [xsl] accessing xsl document ro, David Carlisle |
Re: [xsl] Auto generate XSL softwar, G. Ken Holman | Date | [xsl] Nicer way to change context-n, Frédéric Schwebel |
Month |