[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

AW: For-each error

Subject: AW: For-each error
From: Markus Abt <abt@xxxxxxxx>
Date: Wed, 6 Aug 2003 13:19:24 +0200
xsl for each select attribute
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@xxxxxxxxxxxxxxxxxxxxxx'
Betreff: 	RE:  For-each error

Anyone can help me?

-----Original Message-----
From: AROSO Jose Antonio [mailto:jose.santos@xxxxxxxxxxx]
Sent: terça-feira, 5 de Agosto de 2003 17:40
To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'
Subject: RE:  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@xxxxxxxxxx - email



-----Original Message-----
From:     AROSO Jose Antonio <jose.santos@xxxxxxxxxxx>
Sent:     Tue, 5 Aug 2003 16:25:12 +0100
To:       xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:   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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.