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

RE: Unable to access all element using document functi

Subject: RE: Unable to access all element using document function
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Wed, 11 Sep 2002 11:08:38 +0100
access for element by name
                                      
> I have the following template:                                        
>                                                                       
>                                                                       
> <xsl:template name ="ExtractInfoDoc" >                                
> <xsl:param name="FileA" />                                            
>                                                                       
>   <xsl:for-each select="document($FileA)//*">                         
>                                                                       
>     <xsl:value-of select="document($FileA)//relation/@type"/>         
>     <xsl:value-of select="document($FileA)//relation/role/@name"/>    
>     <xsl:value-of select="document($FileA)/*/object/@id"/>            
>                                                                       
>   </xsl:for-each>                                                     
>                                                                       
> </xsl:call-template>                                                  
>                                                                       
> my interpretation of this template is:                                
>                                                                       
> For each  element in the document 'FileA.xml' display the relation    
> type,                                                                 
> relation role name, and object id  values.                            
>                                                                       
Your interpretation is wrong. The path expressions inside the for-each
are absolute, not relative. Because xsl:value-of prints the value of the
first selected node, what you have written is:

"From the file FileA.xml, display the @type attribute of the first
<relation> element, the first attribute that is an @name attribute of a
<role> within a <relation>, and the first @id attribute of an <object>
belonging to the outermost element. Repeat this as many times as there
are elements in FileA.xml".

You haven't shown your source document, so it's not clear to me what you
really want. I suspect it's something like:

>   <xsl:for-each select="document($FileA)//element">

>                                                                       
>     <xsl:value-of select=".//relation/@type"/>         
>     <xsl:value-of select=".//relation/role/@name"/>    
>     <xsl:value-of select="*/object/@id"/>            
>                                                                       
>   </xsl:for-each>  

Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx   


 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.