xsl-list
[Top] [All Lists]

Re: [xsl] XSL If Statement - Repost

2008-08-22 06:49:17
if your context node is, 'detail' node, you can do as following,

<xsl:if test="matrix = '1'">
  <!-- display table -->
</xsl:if>

if you think, 'matrix' node can contain whitespaces, you should do,

<xsl:if test="normalize-space(matrix) = '1'">

(You are missing single quotes around 1)

Though, I have'nt tried this, but you can also try ...

<xsl:if test="number(matrix) = 1">

On Fri, Aug 22, 2008 at 7:05 PM, sumit patki 
<sumitpatki(_at_)hotmail(_dot_)com> wrote:



Hi,
I have a XSL file which is used to format 100s of xml files. The XSL
converts xml to html.I need to display table in HTML output only if
certain data is present in XML.


In the below code, I need to display the HTML table only if the XML
has matrix tag with 1 in it. Matrix tag will be present only in few
xmls which use the xsl.I tried the below code but none of the options
worked.

XSL:
xsl:for-each select="topic/detail">

xsl:if test="$matrix=1"     OR
xsl:if test="matrix=1"       OR
xsl:if match=".[matrix=1]"

table border="2">
tr>
.
.
.
.
XML:
topic>
   detail>
        matrix>1


-- 
Regards,
Mukul Gandhi

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--