|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Assigning variable values
Variables REALLY cannont have values changed! But it may be possible using some (I don't know what) parsers. I saw this discussion and tested it myself. Look at my example: (Using MSXML4 parser from Microsoft): var.xml ------- <?xml version="1.0" encoding="UTF-8"?> <root> <load>Father</load> </root> var.xslt -------- <?xml version="1.0" encoding="UTF-8"?> <xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:variable name="var" select="/"/> <xsl:variable name="var" select="root/load"/> </xsl:transform> The output was: --------------- The XML page cannot be displayed Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later. ---------------------------------------------------------------------------- ---- Global variable or parameter 'var' cannot be defined more than once with the same import precedence. ======================================= To conclude: ------------ If a var changing value IS supported by a parser or more, it doesn't mean that it is supported by all of them. I consider you should make use of the <xsl:param> instead in order to stay compatible and W3C compliant. It's very important that we all use the same compliance and, besides, you may run your transformation on EVERY parsers! Have you ever thought what may happen if you have to change the parser? Redesign your transformation? Vladimir Stanciu ---------------- vlads@xxxxxx XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
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
|

Cart








