[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Problems with displaying node

Subject: RE: Problems with displaying node
From: "Jacoby, Peter R." <PJACOBY@xxxxxxxxxxxx>
Date: Wed, 28 Apr 2004 09:59:39 -0400
xsl null node
I think that your problem is not with your node test but simply the XPath
expression.  When you use //para it will look anywhere in your document for
a para element, but that's not what you want.

Change your template:
>> <xsl:template match="//para">
>>	<xsl:if test="//para/@invisible!='yes'"> 
>>		<xsl:value-of select="//para"/> 
>> 	</xsl:if> 
>> </xsl:template>

To:

<xsl:template match="para">
	<xsl:if test="@invisible != 'yes'"> 
		<xsl:value-of select="."/>
	</xsl:if>
</xsl:template>


Your test was always returning true because there was always at least para
element that satisfied the condition, but it wasn't necessarily the context
node that you cared about.

Hope this helps.

-Peter

-----Original Message-----
From: Bertrand Sauviat [mailto:bsauviat@xxxxxxxxxxxxxx] 
Sent: Wednesday, April 28, 2004 9:48 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:  Problems with displaying node

In my XML, I have some <para> with an attribute or not. I want use this
attribute to make a test. If the attribute is != null then I don't want to
display the contains of <para>.

Here is my XML:

<document>
<para name="introduction">
    Contains of the introduction
</para>

<para name="author" invisible="yes">
    Name of the author
</para>

<para name="para1">
    Contains of the para1
</para>

<para name="interpara" invisible="yes">
    Contains of the interpara
</para>

</document>

In my XSL, I have make some condition on the @invisible like this:

<xsl:template match="//para">
<xsl:if test="//para/@invisible!='yes'"> <xsl:value-of select="//para"/>
</xsl:if> </xsl:template>

But the output is binary..and don't take into a count my attribute..
Thanks for help

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.