[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: question about XSLT namespace
There have been strong arguments against this, see for example
https://markmail.org/message/dmkpf3cvwpnzkdy2
Suppose I have defined a template rule in an XSLT 2 stylesheet (a XSLT software library if you will), and Ibve been importing this stylesheet from other stylesheets for some time. Suppose there are different namespace URIs for XSLT 2 and 3, with prefixes xsl2 and xsl3. The importing stylesheet did something along the lines <xsl2:template match="foo"> <xsl2:choose> <xsl2:when test="@bar = 'baz'"> b& </xsl2:when> <xsl2:otherwise> <xsl2:next-match/> </xsl2:otherwise> </xsl2:choose> </xsl2:template> delegating to a template rule of the imported stylesheet for the otherwise branch. Then the need arises to do trigonometric computations in the imported library. Therefore I switch it to XSLT 3.0 and change the namespace prefix to xsl3 accordingly. Do I need to change all XSLT 2 stylesheets that import it so that their rules are in the xsl3 namespace? Either the XSLT processor must raise an error if an xsl3 stylesheet is imported from an XSLT 2 stylesheet, or it needs to extend its template matching rules that templates in any of the namespaces that pertain to the prefixes xsl, xsl2, and xsl3 will be treated as being equivalent. Then someone might ask on xsl list (or on xsl3 list?) whether it wouldnbt simplify things if the different versions of the language were denoted by a version attribute but otherwise the namespace was the same. There is great value in being able to seamlessly combine code that is written in different versions of the language, provided that the processor supports all of them. If thatbs an issue, if your XSLT 2 stylesheet should still run (without the new feature that depends on trigonometry) on processors that donbt support XSLT 3, you can maintain a fallback version of the library and do something like this: <xsl:import href="mylib_xslt3.xsl" use-when="xs:decimal(system-property('xsl:version')) ge 3.0"/> <xsl:import href="mylib.xsl" use-when="xs:decimal(system-property('xsl:version')) lt 3.0"/> Both libraries will probably import a third stylesheet into which you put the common functionality. How would you do this importing in the alternative universe with different namespaces and no 'xsl:version' system property? <xsl2:import href="mylib.xsl"/> <xsl3:import href="mylib_xslt3.xsl"/> An XSLT 2 processor might be required to ignore any xsl3:import, but an XSLT 3 processor will import both and overwrite all the rules, functions, variables, keys, etc. of mylib.xsl with those found in mylib_xslt3.xsl, by means of their higher import precedence. This is inefficient. You will get a warning that the common library stylesheet is imported more than once. This is just one aspect. Ibm sure youbll find other replies in the archives, and, as Geert just pointed out and Ibm proving right now, youbll get more replies like this. Gerrit On 15.06.2018 07:30, Mukul Gandhi gandhi.mukul@xxxxxxxxx wrote: Hi all,
Registergericht / Commercial Register: Amtsgericht Leipzig Registernummer / Registration Number: HRB 24930 GeschC$ftsfC<hrer / Managing Directors: Gerrit Imsieke, Svea Jelonek, Thomas Schmidt
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|