[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Compare the value and do something
Cheun N Chong wrote: > > I am wondering whether XSLT can do the following (like normal > programming): > > 1. Pass in a value to the XSL, eg. the current date. Not within XSLT, although almost all transformation processors will provide you with a processor-specific way of achieving this. > 2. Compare the current date to the <BESTBEFORE> tag value. Sure, once you've got the value into an XSLT-accessible parameter. Although support for date manipulation seems to be causing a few headaches, it can be done. > 3. Change the <CONDITION> value if it is expired, if not preserve > the value. Now you're misunderstanding the jobs XSLT does. You may be able to create some logical test which would display one thing or another depending on the provided data, or comparisons between that data, but an XSLT transform does not actually _change_ the source data document, it merely interprets what it's given. This produces the result tree, a new unique object/entity. However, you could probably set up some sort of feedback loop in an XSLT processor environment which could transform XMLa into XMLb with adjusted values. This work would have to be done outside of the XSLT 'language' though, as piping or file saving are not XSLT concepts. > Can XSL do "reading the value of <BESTBEFORE> set it to a variable" Um, I think this is another case of "XSLT does not have write access to the souce document". It can set variables (for the duration of the process) and generate output. It can read the input and set a variable to be the evaluated value (which may be what you want, although your question sounds like the reverse of that). I'll now back off and expect someone else to say I'm totally wrong. Despite what my clock says (2:30PM) it's actually 4:AM again here, so don't trust a word I say. X-) .dan. 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
|