Checking a parent's attribute
I've got some xslt that used to do the following :
but I realised I need it to be conditional on an attribute of one of the parent nodes, so I ended up splitting it up into 3 lines instead :
<xsl:for-each select="ExportEntries"> <xsl:if test="../Restore/@state = 'True'"> <xsl:for-each select="ExportEntry/Field">
This works as I want, but to me it doesn't seem to be the best way. Is there a better way to do that kind of check? I want to restrict it to the "ExportEntries" node first, as there are only a limited number of times that that node will exist, and the "Restore state" node is often there for other things, so I think I'm being more efficient doing it this way. Am I doing this right?
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