tyris
July 16th, 2001, 04:18 AM
hi all
i do have a xml structure this way :
<results dbname="Marketings">
<searchview name="Doc">
<result>
<url>http://etc</url>
<icon>150</icon>
<icon>171</icon>
<description>abcdef</description>
</result>
<result>
<url>http://etc</url>
<icon></icon>
<icon>172</icon>
<description>jaehdeg</description>
</result>
<result>
<url>http://etc</url>
<icon></icon>
<icon></icon>
<description>adhthsdgz</description>
</result>
</searchview>
</results>
what i want is :
if ALL the icon tags are empty, put the description in
bold, else do not put the description in bold and put the
icon url.
my namespace is http://www.w3.org/1999/XSL/Transform"; (MS
XSL 3)
i have found how to test an empty tag :
<xsl:for-each select="icon">
<xsl:choose>
<xsl:when test='. != ""'>
blah...
</xsl:when>
<xsl:otherwise>
blah...
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
now for the test : "if ALL icon tag are empty do this" i
think that i should do something like :
<xsl:for-each select="result">
if ... count(icon!="") = 2 then ...
</xsl:for-each>
(because i will never have more than 2 icon tags, empty or
not)
but how to do this ? i tryed this first test:
<xsl:for-each select="result">
<xsl:value-of select='count(icon!="")'/>
</xsl:for-each>
and i do get this error : Expression does not return a DOM
node. -->count(icon!="")<-- (???)
so here is a first problem (what's wrong with my count
function ?). second question : how to use the count result
in a test like what i wrote above ( if (result of count) =
2 then..)
any help would be appreciated
sorry for my english, i'm french
regards ;-)
elise
i do have a xml structure this way :
<results dbname="Marketings">
<searchview name="Doc">
<result>
<url>http://etc</url>
<icon>150</icon>
<icon>171</icon>
<description>abcdef</description>
</result>
<result>
<url>http://etc</url>
<icon></icon>
<icon>172</icon>
<description>jaehdeg</description>
</result>
<result>
<url>http://etc</url>
<icon></icon>
<icon></icon>
<description>adhthsdgz</description>
</result>
</searchview>
</results>
what i want is :
if ALL the icon tags are empty, put the description in
bold, else do not put the description in bold and put the
icon url.
my namespace is http://www.w3.org/1999/XSL/Transform"; (MS
XSL 3)
i have found how to test an empty tag :
<xsl:for-each select="icon">
<xsl:choose>
<xsl:when test='. != ""'>
blah...
</xsl:when>
<xsl:otherwise>
blah...
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
now for the test : "if ALL icon tag are empty do this" i
think that i should do something like :
<xsl:for-each select="result">
if ... count(icon!="") = 2 then ...
</xsl:for-each>
(because i will never have more than 2 icon tags, empty or
not)
but how to do this ? i tryed this first test:
<xsl:for-each select="result">
<xsl:value-of select='count(icon!="")'/>
</xsl:for-each>
and i do get this error : Expression does not return a DOM
node. -->count(icon!="")<-- (???)
so here is a first problem (what's wrong with my count
function ?). second question : how to use the count result
in a test like what i wrote above ( if (result of count) =
2 then..)
any help would be appreciated
sorry for my english, i'm french
regards ;-)
elise