How to do this?

How to do this?

Post by mali djur » Fri, 04 Jul 2003 16:38:30



Hi, all!

i am newbie in all this stuffs about xsl, so i have few questions for you,
Please, can you tell me is this possible to do, and if you can please give
me some guide lines.

here is problem or whatever:

i got a following xml file:

<root>
    <sub>
        <child>
            <name>john</child>
            <phone>1234</phone>
        </child>
        <child>
            <name>mali</name>
            <phone />
        </child>
        ...
    </sub>
</root>

i want to show this xml in browser in following way:

----------------------------------------------
|                      TEST                                     |
----------------------------------------------
| child name             |     child phone               |
----------------------------------------------
| john                      |           1234                   |
bgColor=blue
----------------------------------------------
|mali                        |                                      |
bgcolor=white
----------------------------------------------
...
----------------------------------------------

problem is that i dont know how to change background colour of <tr>.
and also how to check is value of element null or there is something?

please, help!

thanks

 
 
 

How to do this?

Post by Oleg Tkachenk » Fri, 04 Jul 2003 21:40:52



> problem is that i dont know how to change background colour of <tr>.

Well, this is not really XSLT question. Try
<tr style="background-color:red;">...</tr>

Quote:> and also how to check is value of element null or there is something?

There is no notion of null value. If you want to check element's content there
many ways:
<xsl:if test="elem/text()"> <!-- Checks if elem element has any text children
node -->
<xsl:if test="elem != ''"> <!-- Checks if elem element's string value is not
empty string -->
etc.
--
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel

 
 
 

How to do this?

Post by mali djur » Fri, 04 Jul 2003 21:02:32




> > problem is that i dont know how to change background colour of <tr>.
> Well, this is not really XSLT question. Try
> <tr style="background-color:red;">...</tr>

ok, i done it, but my problem wasn't
<tr style="background-color:red;">
i knew that but i didn't know how to work with xsl:choose, that was a
problem.

Quote:

> > and also how to check is value of element null or there is something?
> There is no notion of null value. If you want to check element's content
there
> many ways:
> <xsl:if test="elem/text()"> <!-- Checks if elem element has any text
children
> node -->
> <xsl:if test="elem != ''"> <!-- Checks if elem element's string value is
not
> empty string -->
> etc.

thanks
Quote:> --
> Oleg Tkachenko
> http://www.tkachenko.com/blog
> Multiconn Technologies, Israel