Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 14th, 2007, 09:14 AM
Authorized User
 
Join Date: Jan 2006
Location: tel aviv, israel, Israel.
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
Default if option

hello

I am trying to make an if on an xsl in order to get a specific output.
my etd is:
<entity eid="A" tid="501" plural-tid="502" grouping-tid="503" plural-grouping-tid="504" length="256">
<data class="activity" type="varchar" dbcolumn="MAIL_MSG" mandatory="yes" last-summary="all" collection-id="msg" />
</entity>


<entity eid="U" tid="511" plural-tid="512" grouping-tid="513" plural-grouping-tid="514" length="256">
<data class="user_name" type="varchar" dbcolumn="SENDER" mandatory="yes" last-summary="all" collection-id="sender" />
</entity>


<entity eid="C" tid="521" plural-tid="522" grouping-tid="523" plural-grouping-tid="524" length="256">
<data class="client_ip" type="varchar" dbcolumn="SENDER_IP" mandatory="yes" last-summary="all" collection-id="C_IP" />
</entity>

in the xsl:

<xsl:if test = "/etd/entities/entity/data/@class = 'client_ip'">
<xsl:with-param name="line" select="concat(./@collection-id,'_GID', '/',$column_name,'_GID', '/location' ,'/INT_ID')"/>
</xsl:if>

I want in the out put to write in line only for the class where it is client_ip. instead, it is doing the output for all 3 entity and doing the line with _GID for all 3 of them.

how can I filter in order to have in the output the _GID line only where the class is client_ip?

thanks

Reply With Quote
  #2 (permalink)  
Old May 14th, 2007, 09:39 AM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

You haven't given enough information for a precise answer.

<xsl:if> can never be used around an <xsl:with-param>, it can only be used around an instruction.

<xsl:if test = "/etd/entities/entity/data/@class = 'client_ip'"> tests whether such an entity exists anywhere in the document (because you're selecting starting from "/", the root node). You probably want to test whether the current entity has data/@class = 'client_ip'. If the current node is an entity node, use <xsl:if test = "data/@class = 'client_ip'">

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Option for decode yogeshyl SQL Language 0 July 6th, 2008 11:52 PM
Is there a "like" option? crabjoe Classic ASP Basics 4 June 9th, 2008 03:42 PM
Create Check Boxes/Option buttons/Option Group hewstone999 Access VBA 1 March 14th, 2008 07:25 AM
Option group vnadig Access 6 September 8th, 2004 02:53 PM



All times are GMT -4. The time now is 03:25 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.