[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Correlation between two xml trees
Hello John,
it's not so difficult: $data stores the z:row, you are currently processing. So with $data you can easily access this z:row. With the for-each you switch the context away from the z:row to $outputdef. The columns in $outputdef have an attribute @dbcolumn, which is normally accessed via <xsl:value-of select="@dbcolumn"/>. Now from the z:row in $data you want to get the value of either @col1, @col2 or @col3. The attribute you want to access is stored in @dbcolumn. So you want to have the value of this attribute, whose name is the same as the value stored in @dbcolumn. $data/@* means "all attributes of the z:row stored in $data". The predicate [] restricts the selection of this expression. Everything in the predicate refers to the node/attribute/etc. directly before the predicate. So @*[name()] means the name() of the attribute. With current() we switch the context away from these attributes to the context element, which is at the moment a column from $outputdef/root/cloumn (see for-each). So $data/@*[name()=current()/@dbcolumn] means return the value of all the attributes, whose name() is the same as the value of the @dbcolumn of the currently processed element. Of course this is only one. (<xsl:value-of/> also selects always only the value of the first node/attribute in a nodeset.) I hope, this explanation was not to much,to less or to buggy ;-) Regards, Joerg John Sands wrote: Hi Joerg, -- System Development VIRBUS AG Fon +49(0)341-979-7419 Fax +49(0)341-979-7409 joerg.heinicke@xxxxxxxxx www.virbus.de XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|