Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 14th, 2007, 09:14 AM
Authorized User
 
Join Date: Jan 2006
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

 
Old May 14th, 2007, 09:39 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
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





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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.