xsl-list
[Top] [All Lists]

Re: XSL siblings

2005-06-28 03:35:54





Hi,
         If youd' like to loop over all displaylocations it would make
sense to maintain the context node one level above. Thus you could set up
your for-each' as follows:

     <xsl:for-each select="LISTOFDISPLAYLOCATIONS">
         <xsl:if test"DISPLAYLOCATION[DISPLAYLOCATIONID='3']"> <!-- test if
a DISPLAYLOCATION with child DISPLAYLOCATIONID=3 exists -->
            <!-- If I understand you correct you want to loop over all
display locations here  -->
            <!-- This can be done as follows -->
            <xsl:for-each select="DISPLAYLOCATION">
                  <xsl:value-of select="DISPLAYLOCATIONNAME"/>
            </xsl:for-each>


Hope this helps.

Cheers,
Prakash









                                                                                
                                                
                      -= jay =-                                                 
                                                
                      <deepsweech(_at_)gmai         To:      
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com                                
         
                      l.com>                   cc:      (bcc: 
omprakash.v/Polaris)                                              
                                               Subject: Re: [xsl] XSL siblings  
                                                
                      06/28/2005 03:46                                          
                                                
                      PM                                                        
                                                
                      Please respond                                            
                                                
                      to xsl-list                                               
                                                
                                                                                
                                                
                                                                                
                                                




sorry my mistake, it is
<xsl:if test="$locationId='3'">
all is working except the displaying all DISPLAYLOCATIONS nodes

thanks
jay

On 6/28/05, omprakash(_dot_)v(_at_)polaris(_dot_)co(_dot_)in 
<omprakash(_dot_)v(_at_)polaris(_dot_)co(_dot_)in> wrote:





Hi,
      The following line seem to be the problem:

             <xsl:if test"$locationId =3">
                                            ^^^

the test for equality should be

             <xsl:if test"$locationId ='3'">

Also, xsl:variable doesn't support the id attribute and Iam sure that
you
must have put that there in your haste.

Cheers,
Omprakash.V







                     -= jay =-
                     <deepsweech(_at_)gmai         To:
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
                     l.com>                   cc:      (bcc:
omprakash.v/Polaris)
                                              Subject: Re: [xsl] XSL
siblings
                     06/28/2005 02:51
                     PM
                     Please respond
                     to xsl-list






tnx for the reply Michael, I tried using "../C" it doesnt work either:
now here's my actual code. it's quite long im very sorry,

my xml:
<GetServiceInfoResult_1>
 <SERVICE itmns="1">
   <SERVICEID>10003</SERVICEID>
   <LISTOFLOCATIONS>
     <LOCATION>
       <LOCATIONID>3</LOCATIONID>
       <LOCATIONNAME>DEFAULT</LOCATIONNAME>
     </LOCATION>
   </LISTOFLOCATIONS>
   <LISTOFLOCATIONS>
     <LOCATION>
       <LOCATIONID>4</LOCATIONID>
       <LOCATIONNAME>OFFICE</LOCATIONNAME>
     </LOCATION>
   </LISTOFLOCATIONS>
   <LISTOFDISPLAYLOCATIONS>
     <DISPLAYLOCATION>
       <DISPLAYLOCATIONID>3</DISPLAYLOCATIONID>
       <DISPLAYLOCATIONNAME>DEFAULT</DISPLAYLOCATIONNAME>
     </DISPLAYLOCATION>
     <DISPLAYLOCATION>
       <DISPLAYLOCATIONID>7</DISPLAYLOCATIONID>
       <DISPLAYLOCATIONNAME>AWAY</DISPLAYLOCATIONNAME>
     </DISPLAYLOCATION>
   </LISTOFDISPLAYLOCATIONS>
   <LISTOFCATEGORY>
     <CATEGORY>
       <CATEGORYID>10</CATEGORYID>
       <CATEGORYNAME>Philosophy, Pyschology and Religion</CATEGORYNAME>
       <CATEGORYDESCRIPTION>Philosophy, Pyschology and
Religion</CATEGORYDESCRIPTION>
     </CATEGORY>
     <CATEGORY>
       <CATEGORYID>11</CATEGORYID>
       <CATEGORYNAME>Reference</CATEGORYNAME>
       <CATEGORYDESCRIPTION>Reference</CATEGORYDESCRIPTION>
     </CATEGORY>
   </LISTOFCATEGORY>
... and so on

so the 3 sibling nodes are LISTOFDISPLAYLOCATIONS, DISPLAYLOCATIONS
and LISTOFCATEGORY

first is i filter through LISTOFCATEGORY which SERVICE to display(i
pass a $setSubjectId variable)
<xsl:for-each select="//SERVICE[LISTOFCATEGORY/CATEGORY/CATEGORYID =
$setSubjectId]">

  now i check if the SERVICE can be displayed
    <xsl:for-each select="LISTOFDISPLAYLOCATIONS/DISPLAYLOCATION">
         <xls:variable id="locationId"
select="DISPLAYLOCATIONID"/>
             <xsl:if test"$locationId =3">
             now i want to loop through DISPLAYLOCATIONS and display all
of'em


Thanks verymuch michael!
jay

--~------------------------------------------------------------------
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>
--~--





This e-Mail may contain proprietary and confidential information and is
sent for the intended recipient(s) only.
If by an addressing or transmission error this mail has been misdirected
to you, you are requested to delete this mail immediately.
You are also hereby notified that any use, any form of reproduction,
dissemination, copying, disclosure, modification,
distribution and/or publication of this e-mail message, contents or its
attachment other than by its intended recipient/s is strictly prohibited.

Visit Us at http://www.polaris.co.in

--~------------------------------------------------------------------
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>
--~--




--
*-::jay::-*

--~------------------------------------------------------------------
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>
--~--





This e-Mail may contain proprietary and confidential information and is sent 
for the intended recipient(s) only. 
If by an addressing or transmission error this mail has been misdirected to 
you, you are requested to delete this mail immediately.
You are also hereby notified that any use, any form of reproduction, 
dissemination, copying, disclosure, modification,
distribution and/or publication of this e-mail message, contents or its 
attachment other than by its intended recipient/s is strictly prohibited.

Visit Us at http://www.polaris.co.in

--~------------------------------------------------------------------
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>
--~--



<Prev in Thread] Current Thread [Next in Thread>