Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - Re: Boolean true and false as strings >Thread Next - Re: Boolean true and false as strings Re: Boolean true and false as stringsTo: NULL Date: 1/8/2009 2:28:00 AM I'm using the XSLT scripts in MATLAB. That mean Saxon on XSLT 1.0. I guess what you said about the nodeset extension means I should made my code something like this: <xsl:variable name="DEVICE_TYPE_FLAGS"> <xsl:choose> <xsl:when test="$APP_MODEL = 2812"> <IS_ICD>true</IS_ICD> <IS_ATRIAL_ICD>true</IS_ATRIAL_ICD> </xsl:when> <xsl:otherwise> <IS_ICD>true</IS_ICD> <IS_ATRIAL_ICD>false</IS_ATRIAL_ICD> </xsl:otherwise> </xsl:choose> </xsl:variable> But I'm still stuck with strings in the text node of tags like <IS_ICD>. Is there a way that I can make the contents inside a tag boolean? Thanks. Cheers, Hoi "David Carlisle" <david-news@d...> wrote in message news:49652F4A.7020601@d...... > Hoi Wong wrote: >> I accidentially hit send before finishing... >> >> ============================= >> >> As I'm trying to do conditional variable assignment (see the post below), >> I >> have to use >> >> <xsl:variable name="someName"> >> <xsl:value-of select="true()"/> >> </xsl:variable> >> >> instead of >> >> <xsl:variable name="someName" select="true()"/> >> >> but apparently value-of select converts my variable to string instead of >> boolean, and that leaves a dangerous trap in my code that people who >> follow up might try to test the string and always return TRUE. >> >> Is there any other ways to assign boolean values using <xsl:variable> >> without putting "select" at the same line. >> >> Thanks. >> >> Cheers, >> Hoi > > you coul duse copy-of instead of value-of which avoids value-of making a > text node, but in xslt1, it won't help as if you use xsl:variable without > a select attribute the result is a result tree fragment, which isn't what > you want. > > > If you are using xslt2 you can use if()... then... else ... within the > select expression. > > If you are using xslt1 and have access to a x:noe-set() extesnion function > (almost all xslt 1 engines support this) then normally the thing to do is > not define 40 global variables but rather just define one structured > variable. > > so don't use $a1, ..... $a40, use > $a/a1, ...$a/a40 > > where the global variable $a holds an in-memory XML fragment that you > construct that contains all the data. > > David > > -- > http://dpcarlisle.blogspot.com | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
