[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: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 4 Dec 2009 23:14:43 GMT

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


Current Thread
Keywords
xsd