xsl-list
[Top] [All Lists]

AW: For-each error

2003-08-06 04:19:24
Hi Jose,

this variable:
<xsl:variable name="pkname" select="../../Key_Group_Groups/Key_Group/@Name" />
contains (in your example) two attribute nodes:
-  Name="Primary Key", and
-  Name="Foreign Key1".

This value-of:
<xsl:value-of select="$pkname" />
outputs the text content of the first node in the variable $pkname,
so you will get "Primary Key".

This corresponds exactly to the definition of the <xsl:value-of> statement
in the XSLT spec.

If you want to output all attribute nodes' values as text, you can use a loop:
<xsl:for-each select="$pkname">
   <xsl:value-of select="." />
</xsl:for-each>


Btw., in your example, you open three <xsl:for-each> loops, but you close
only one, so it's hard to deduce what you are trying to achieve.

Regards,
Markus
__________________________
Markus Abt
Comet Computer GmbH
http://www.comet.de



----------
Von:    AROSO Jose Antonio
Gesendet:       Mittwoch, 6. August 2003 11:06
An:     'xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com'
Betreff:        RE: [xsl] For-each error

Anyone can help me?

-----Original Message-----
From: AROSO Jose Antonio [mailto:jose(_dot_)santos(_at_)enabler(_dot_)com]
Sent: terça-feira, 5 de Agosto de 2003 17:40
To: 'xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com'
Subject: RE: [xsl] For-each error


Sorry, but you dont analyze very well the xml file.
I set the important text with /*... */.



As I inspect your XML, I see that you have exactly one element that matches
the XPath expression in the select attribute of your <xsl:for-each> element.
Consequently, you can only expect to get one "Name" attribute to match.

(Text will not appear in bold in email, as a rule. You should try setting
the important text off in some other way.)
-- 
Charles Knell
cknell(_at_)onebox(_dot_)com - email



-----Original Message-----
From:     AROSO Jose Antonio <jose(_dot_)santos(_at_)enabler(_dot_)com>
Sent:     Tue, 5 Aug 2003 16:25:12 +0100
To:       xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject:  [xsl] For-each error

Hi.

I have a little error and i cant solve it.
In following xsl in for-each loop i didnt catch all of the @name. Always
catch the first.(do not continue the loop)
The problem is in the bold text.

<xsl:for-each select="Entity_Groups/Entity">
                                <p/>
                                TABELA:
                                <xsl:value-of select="@Name" /> 
                                
                                <br/>
                                
                                COMENTARIOS:
                                <xsl:value-of select="EntityProps/Comment"
/> 
                                
                                <p/>
                                                                        
                                <table>
                        
        
<tr><th>NOME<th>TIPO<th>COMENTARIOS</th></th></th>

                                </tr>
                                
                                <xsl:for-each
select="Attribute_Groups/Attribute">
                                
                                <tr>
                                
                                        <td>
                                                <xsl:value-of select="@Name"
/>
        

                                        </td>
                                                
                                        <td>
                                                <xsl:value-of
select="AttributeProps/Type" />                 
                                        </td>
                                
                                        <td>
                                                <xsl:value-of
select="AttributeProps/Definition" />           
                                        </td>
                                
                                </tr>
                                                                        
                                </xsl:for-each>
                                
                                </table>
                                <xsl:for-each
select="Attribute_Groups/Attribute">
                                
                                                <xsl:variable name="aid"
select="@id" />
                                                <xsl:variable name="kid"
select="../../Key_Group_Groups/Key_Group/Key_Group_Member_Groups/Key_Group_M
ember/Key_Group_MemberProps/Key_Group_Member_Column" />

/*                                              <xsl:variable name="pkname"
select="../../Key_Group_Groups/Key_Group/@Name" /> */
                                                <xsl:value-of
select="$pkname" />


The xml file is like this:



<Entity_Groups>
<Entity id="{3DA5AB80-B9ED-4CA2-B9B7-480DB542F39D}+00000000" Name="Carro">
<EntityProps>
  <Name>Carro</Name> 
</EntityProps>
<Attribute_Groups>
<Attribute id="{F5E2C69B-9D73-4AAF-8708-4E59B9163BB2}+00000000"
Name="id_carro">
<AttributeProps>
  <Name>id_carro</Name> 
  <Type>0</Type> 
</AttributeProps>
</Attribute>
<Attribute id="{FF67ADDA-041A-49DA-ABEB-BFC6E23567DE}+00000000"
Name="id_cliente">
<AttributeProps>
  <Name>id_cliente</Name> 
  <Type>0</Type> 
</AttributeProps>
</Attribute>
<Attribute id="{365615F0-C81B-4E7E-9CB6-3329D72E8E7B}+00000000"
Name="marca">
<AttributeProps>
  <Name>marca</Name> 
  <Type>100</Type> 
</AttributeProps>
</Attribute>
</Attribute_Groups>
<Key_Group_Groups>
/*    <Key_Group id="{21AF6A3E-99EE-4EFD-B696-428FB24780D6}+00000000"
Name="Primary Key">   */
<Key_GroupProps>
  <Key_Group_Type>PK</Key_Group_Type> 
  <Index_Generate>1</Index_Generate> 
  </Key_GroupProps>
<Key_Group_Member_Groups>
<Key_Group_Member id="{725C3DBA-741E-49E5-B128-85D3535549A6}+00000000"
Name="1">
<Key_Group_MemberProps>
 
<Key_Group_Member_Column>{F5E2C69B-9D73-4AAF-8708-4E59B9163BB2}+00000000</Ke
y_Group_Member_Column> 
</Key_Group_MemberProps>
</Key_Group_Member>
<Key_Group_Member id="{6A09E74F-91EE-4E5D-9B01-4DCAD986BC99}+00000000"
Name="2">
<Key_Group_MemberProps>
 
<Key_Group_Member_Column>{FF67ADDA-041A-49DA-ABEB-BFC6E23567DE}+00000000</Ke
y_Group_Member_Column> 
  </Key_Group_MemberProps>
  </Key_Group_Member>
  </Key_Group_Member_Groups>
  </Key_Group>
/*    <Key_Group id="{4086BD93-83EC-4EEE-ABBE-D995C20B52EA}+00000000"
Name="Foreign Key1">    */
<Key_GroupProps>
  <Key_Group_Type>IF1</Key_Group_Type> 
 
<Key_Group_Relationship_Pointer>{45258159-117C-4EA1-AA80-CBA4485E3469}+00000
000</Key_Group_Relationship_Pointer> 
  </Key_GroupProps>
<Key_Group_Member_Groups>
<Key_Group_Member id="{6BEBB002-D906-4EC9-879B-04CA90158BB2}+00000000"
Name="1">
<Key_Group_MemberProps>
 
<Key_Group_Member_Column>{FF67ADDA-041A-49DA-ABEB-BFC6E23567DE}+00000000</Ke
y_Group_Member_Column> 
  </Key_Group_MemberProps>
  </Key_Group_Member>
  </Key_Group_Member_Groups>
  </Key_Group>
  </Key_Group_Groups>
</Entity>



Best Regards

Jose 

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




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

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

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



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



<Prev in Thread] Current Thread [Next in Thread>
  • AW: For-each error, Markus Abt <=