xsl-list
[Top] [All Lists]

Re: [xsl] accessing xsl document root from an included stylesheet

2009-12-04 18:15:18


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.

so be default you want it to complain. so in your core stylesheet that's
include dinto everything have

<xsl:template match="/*">
  <xsl:message>
  Go away: you are the wrong sort of thing.
  </xsl:message>
</xsl:template>

Then in a stylesheet that xsl:imports this stylesheet and is inteneded
for http://example.com/a namespace do

<xsl:styesheet xmlns:a="http://example.com/a"; ...

<xsl:template match="/a:*>
  <something>
     <xsl:apply-templates/>


and similarly another styleseet inplementing a different namespace would
be the same but just letting its namespace through. Any input for which
the top level element doesn't have teh expected namespace will be
matched by the error message template in the included/imported common
stylesheet.

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. 
________________________________________________________________________

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--