• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

xsl and check if a xsl:value-of select="temp" is -999°C

 
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
i have a XML "document" that read different stuff.

one thing is temp,
<temp> -999°C </temp>
But of the "XML-source" don't have a temp-sensor it says -999°C
so -50°C to +100 °C in "normal"
and -999°C is "we don't have sensor"

I then make a html document with xml and xsl.

BUT here is the problem! :-(

- How can I "catch" the "-999°C" and change this to "Tempsensor is missing"?

try1:
this don't work:


try2:
this don't work:


Do anybody have any ides?


ant then
if i want to change 'ö' to ??
how do i do that in xls??? :-?

And how do i change

to
" ö "
?
:-)
 
Marshal
Posts: 28174
95
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you want to compare something to a string literal in an <xsl:if> element then you have to put quotes around that literal. Like so:



ant then
if i want to change 'ö' to ö ??
how do i do that in xls??? :-?



Sorry, there's not enough context to that. Where is this quoted string from which you want to drop the quotes?

And how do i change
ö
to
ö
?



Make sure that whatever is displaying that character knows that it's being encoded in UTF-8 for display. (That's a guess at your real question, too, since you provided no context for it.)
 
Niklas Karlsson
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Paul Clapham wrote:If you want to compare something to a string literal in an <xsl:if> element then you have to put quotes around that literal. Like so:



ant then
if i want to change 'ö' to ö ??
how do i do that in xls??? :-?



Sorry, there's not enough context to that. Where is this quoted string from which you want to drop the quotes?

And how do i change
ö
to
ö
?



Make sure that whatever is displaying that character knows that it's being encoded in UTF-8 for display. (That's a guess at your real question, too, since you provided no context for it.)


HI
thanks for your repply!
please look at the updated text (but remove all "-" )
(and i use UTF-8 :-( )
 
Paul Clapham
Marshal
Posts: 28174
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Niklas Karlsson wrote:
thanks for your repply!
please look at the updated text (but remove all "-" )
(and i use UTF-8 :-( )



Sorry, what updated text?

And if you're seeing ö in your output then you aren't using UTF-8 there. It's possible (and quite likely) that your XML document is encoded in UTF-8, but whatever you use for output assumes something else.
 
Niklas Karlsson
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Paul Clapham wrote:

Niklas Karlsson wrote:
thanks for your repply!
please look at the updated text (but remove all "-" )
(and i use UTF-8 :-( )



Sorry, what updated text?

And if you're seeing ö in your output then you aren't using UTF-8 there. It's possible (and quite likely) that your XML document is encoded in UTF-8, but whatever you use for output assumes something else.



hi i think the XML i recive is NOT in real UTF-8
but "the other things are..."
can i transform the ö to the "ö" afterwords?
 
Paul Clapham
Marshal
Posts: 28174
95
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If your XML contains a degree character (as in "-999 ° C") then it's almost certainly encoded in UTF-8, but anyway you can tell by looking at the document's declaration -- either it specifies the encoding, or else it's encoded in UTF-8 (or UTF-16).

And if I understand your situation correctly, you're doing an XSL transformation which puts its output -- somewhere. And you're using -- something -- to look at that output. So there are two questions to ask about that: first, what encoding is the XSL transformation's output using? And second, when you look at that output, what encoding is that looking thing assuming?

You seem to think that "ö" is in your XML document somewhere and that you can deal with it on that basis. But the "ö" character requires two bytes when it's encoded in UTF-8. If you use UTF-8 throughout the process then you'll see that character on your screen. But if at some point your software interprets those two bytes as if they were encoded in ISO-8859-1 or cp-1252 or some similar encoding, then you're going to see "ö" on your screen. So as I've explained, there are two places you have to look at to find out where the problem is.
 
Niklas Karlsson
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Paul Clapham wrote:If your XML contains a degree character (as in "-999 ° C") then it's almost certainly encoded in UTF-8, but anyway you can tell by looking at the document's declaration -- either it specifies the encoding, or else it's encoded in UTF-8 (or UTF-16).

And if I understand your situation correctly, you're doing an XSL transformation which puts its output -- somewhere. And you're using -- something -- to look at that output. So there are two questions to ask about that: first, what encoding is the XSL transformation's output using? And second, when you look at that output, what encoding is that looking thing assuming?

You seem to think that "ö" is in your XML document somewhere and that you can deal with it on that basis. But the "ö" character requires two bytes when it's encoded in UTF-8. If you use UTF-8 throughout the process then you'll see that character on your screen. But if at some point your software interprets those two bytes as if they were encoded in ISO-8859-1 or cp-1252 or some similar encoding, then you're going to see "ö" on your screen. So as I've explained, there are two places you have to look at to find out where the problem is.



thank you for your answer! :-)

I have looked at the XML i recive and it is UTF-8
BUT here comes the intresting part:
there is the CDATA in an element that have the "ö" !!
and the degre is in "html-code-format"..

the site
http://www.i18nqa.com/debug/utf8-debug.html
probably help me decode the "predicted" strange char that can come around..

 
Paul Clapham
Marshal
Posts: 28174
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay. So do you still have a question?
 
reply
    Bookmark Topic Watch Topic
  • New Topic