Subject: RE: [xsl] Assigning variable values From: "Vladimir Stanciu" <vlads@xxxxxx> Date: Mon, 27 May 2002 09:33:20 +0300 |
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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Assigning variable values, Georges Claessen | Thread | Re: [xsl] Assigning variable values, David Carlisle |
RE: [xsl] Does saxon:output do an H, Julian Reschke | Date | [xsl] Select a node in another xml-, Pfitzner, Jan |
Month |