[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Referring to stylesheet itself, possible in XSLT 1
Michael Kay wrote:
I understand, but it really just said "Transformation failed". Without any descriptive error, warning or whatever.That's a bit puzzling. Calling document() with a URI that doesn't exist is a It was puzzling me too. I use Oxygen's Eclipse plugin for testing the XSLT. Normally it simply lists all the errors. Now it just said "Transformation failed". I learned something: try it outside of the IDE box. The following happens: With this stylesheet: --------------------- <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> <xsl:template match="/"> 1) <xsl:value-of select="document-uri(document(''))"></xsl:value-of> 2) <xsl:value-of select="static-base-uri()"></xsl:value-of> 3) <xsl:value-of select="base-uri(.)"></xsl:value-of> </xsl:template> </xsl:stylesheet> This output: ------------ <?xml version="1.0" encoding="UTF-8"?> 1) file:/D:/Workspaces/Eclipse/etc/def/config/test.xslt 2) file:/D:/Workspaces/Eclipse/ect/def/config/test.xslt 3) file:/D:/Workspaces/Eclipse/etc/def/config/test.xml
This output: ------------ Error on line 1 column 1 of file:/D:/Workspaces/Eclipse/etc/: SXXP0003: Error reported by XML parser: Content is not allowed in prolog. Recoverable error on line 5 of file:/D:/Workspaces/Eclipse/etc/def/config/test.xslt: FODC0005: org.xml.sax.SAXParseException: Content is not allowed in prolog. <?xml version="1.0" encoding="UTF-8"?> 1) 2) file:/D:/Workspaces/Eclipse/etc/ 3) file:/D:/Workspaces/Eclipse/etc/test.xml I believe in the light of what all people said on this subject, this behavior is to be expected. Try putting xml:base at the level of the stylesheet where you need it, e.g. on a template rule, and have a global variable The xml:base was used to make xsl:import easier. I did not want to add it to each xsl:import statement. But I guess, I'd have to decide on the pros and cons of either technique. At least I understand now what's happening.
|
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
|