xsl-list
[Top] [All Lists]

Re: element selection based on attribute value not working - xsl, fop, pdf

2003-09-19 01:55:05
Hi Vinod,

You may also do for e.g. --

<xsl:for-each
select="communicationmethodsActual[(_at_)PURPOSE =
'PHONE']">
  <xsl:if test="position() = 1">
    <!-- display label -->
    <xsl:text>Phone nos</xsl:text>
  </xsl:if>
  <!-- processing -->
</xsl:for-each>

<xsl:for-each
select="communicationmethodsActual[(_at_)PURPOSE =
'EMAIL']">
  <xsl:if test="position() = 1">
    <!-- display label -->
    <xsl:text>Emails</xsl:text>
  </xsl:if>
  <!-- processing -->
</xsl:for-each>

<xsl:for-each
select="communicationmethodsActual[(_at_)PURPOSE = 'FAX']">
  <xsl:if test="position() = 1">
    <!-- display label -->
    <xsl:text>Fax nos</xsl:text>
  </xsl:if>
  <!-- processing -->
</xsl:for-each>

Regards,
Mukul

--- vinod(_dot_)agarwal(_at_)nl(_dot_)abnamro(_dot_)com wrote:
thanks for the answer. But, my problem is that I
cannot use the for-each
loop as it will fetch only one element at a time.
But, I want all the matching "PHONE" attribute
"communicationmethodsActual"
elements at once and likewise for
"EMAIL", "FAX" etc. One such reason for this is that
I want to print the
label "phone" , "email" only once for a group of
such elements, and that is possible only if I get
all the related elements
in one go and I use the "position()" function to
check for "position() = 1" and print the label.

tia.
--vinod.







Mukul Gandhi
<mukulw3(_at_)yahoo(_dot_)com>@lists.mulberrytech.com on
09/18/2003
07:19:05 PM

Please respond to xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com

Sent by:    owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com


To:    xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
cc:
Subject:    Re: [xsl] element selection based on
attribute value not
       working - xsl, fop, pdf


Hi Vinod,
the syntax you have posted is correct.. don't know
why
its not working. You may also try --

<xsl:for-each select="communicationmethodsActual">
   <xsl:if test="@PURPOSE = 'PHONE'">
     <!-- some processing -->
   </xsl:if>
   <xsl:if test="@PURPOSE = 'EMAIL'">
     <!-- some processing -->
   </xsl:if>
   <xsl:if test="@PURPOSE = 'FAX'">
     <!-- some processing -->
   </xsl:if>
</xsl:for-each>

But your way looks more elegant..

Regards,
Mukul


<xsl:apply-templates


select="communicationmethodsActual[(_at_)PURPOSE='PHONE']"/>
<xsl:apply-templates


select="communicationmethodsActual[(_at_)PURPOSE='FAX']"/>
<xsl:apply-templates


select="communicationmethodsActual[(_at_)PURPOSE='EMAIL']"/>


But, the apply-templates with attribute selection
is
not working. It doesn't select any node wih the
above syntax.


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site
design software
http://sitebuilder.yahoo.com

 XSL-List info and archive: 
http://www.mulberrytech.com/xsl/xsl-list





---------------------------------------------------------------------------
 This message (including any attachments) is
confidential and may be
 privileged. If you have received it by mistake
please notify the sender by
 return e-mail and delete this message from your
system. Any unauthorised
 use or dissemination of this message in whole or in
part is strictly
 prohibited. Please note that e-mails are
susceptible to change.
 ABN AMRO Bank N.V. (including its group companies)
shall not be liable for
 the improper or incomplete transmission of the
information contained in
 this communication nor for any delay in its receipt
or damage to your
 system. ABN AMRO Bank N.V. (or its group companies)
does not guarantee
 that the integrity of this communication has been
maintained nor that this
 communication is free of viruses, interceptions or
interference.


---------------------------------------------------------------------------





 XSL-List info and archive: 
http://www.mulberrytech.com/xsl/xsl-list



__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list