xslt 1.0 - Can we declare global variable and add/Remove/Check value from it? -


I want to receive

Announce the global value of No value

  & lt; Xsl: variable name = "isEqual" />   

Check changes to variable values ​​and status

  & lt; Xsl: select & gt; ** // check value equals or not ** & lt; Xsl: when test = "name = $ name" & gt; & Lt; XSL: Select & gt; ** // Variable Value Checking ** & lt; Xsl: When testing = "$ eSeal! = 'Unequal' '& gt; ** // Setting variable value ** & lt; xsl: variable name =" isEqual "=" Similar "/>  & lt; / XSL: otherwise> gt; / XSL: select & gt; & lt; xsl: select value = "$ IsEqual" / & Gt;   

Expected output value of variable $ ISEqual .. If this is not possible, then what is the other way to get it? What do I do instead of variables

"This is not a bug, it's a feature": xslt variables are designed to not be variable. in fact, can be labeled constant name is difficult to work around it, it can be done by using parameters. is not necessary in most cases if you use XSLT programming effort Where the program is created through a template Is operated by TA.
Your question is not answered.
copied from this (self) text

@Sam: Do you want to complete using a global variable? Where do you want to check equality? I do not know what you want to do, so I can give you just a simple example.
Try this XML file:

  & lt ;? Xml version = "1.0" encoding = "UTF-8" & gt; & Lt ;? Xml-stylesheet type = "text / xsl" href = "test.xsl"? & Gt; & Lt; Root & gt; & Lt; Data check = "value 1" & gt; This data is for 1 & lt; / Data & gt; & Lt; Data check = "value 2" & gt; This data is 2 & lt; / Data & gt; & Lt; Data check = "value 3" & gt; This data is 3 & lt; / Data & gt; & Lt; / Root & gt;   

with this XSLT file:

   & Lt; / XSL: Templates & gt; & Lt; Xsl: template match = "data" & gt; & Lt; Xsl: value selection = "." / & Gt; & Lt; / XSL: Templates & gt; & Lt; / XSL: stylesheet & gt;   

Only the second data element will be shown because it matches a global variable, which remains the same at all times. If you want to match with different values, you can convert them to a data variable instead of one variable and compare different elements. To test just save two files (test.xml and test.xsl) in a directory and open test.xml with your browser

@sam again: As you insist on changing an XSLT variable I have to repeat it that it can not be done. Probably there is a way around using environment XSLT. E.g. PHP, where you can work in the script. I have described the technique here:

XSLT SPECK says:
XSLT does not provide Java equivalent assignment operator - X = "value";
Because this will make it difficult to make an implementation which starts from the beginning of a batch-like manner, and continues in the end.
(To prove your question "no" is correct to see: -)

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -