Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Need to get previous node

From: Martin Honnen <mahotrash@-----.-->
To: NULL
Date: 8/6/2009 2:02:00 PM
tshad wrote:

> When you say current node, are you talking about everything inside the PHOTO 
> tags?

Tags are part of the markup that the XML parser deals with. XSLT 
operates on a tree of nodes. Within
   <xsl:template match="FORMPHOTOS/PHOTO">
the current node is a element node with name 'PHOTO'.

> Or FORMPHOTOS as well.  In otherword, if I change the FORMPHOTOS element to:
> 
> <FORMPHOTOS LABEL="HOUSE">
> 
> Could I have also accessed the LABEL as:
> 
>    <source>
>      <xsl:value-of select="@HOUSE"/>

That does not make much sense. The attribute name is 'LABEL', not 
'HOUSE'. And the FORMPHOTOS element is the parent element of the PHOTO 
element(s) so inside of
   <xsl:template match="FORMPHOTOS/PHOTO">
to access the LABEL attribute of the FORMPHOTOS element you need to use
       <xsl:value-of select="../@LABEL"/>

> When you say that "Inside of the square brackets the context node is no 
> longer the PHOTO element but rather that * child element", what is the * 
> child element refering to?

* is a wildcard. You had ../../FIELDS/* and then added a predicate so 
that predicate applies to any child element of the FIELDS element(s).

-- 

	Martin Honnen --- MVP XML
	http://msmvps.com/blogs/martin_honnen/


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent