Useful XSL
To cut a long story short, say I wanted to get all the Car elements in /Ancillary/Cars, but I didn’t want to limit my XSLT to hardcoded Cars. I also might want to do it with all the /Ancillary/Vans in my XML document that I may have. Normally you would write –
<xsl:for-each
select=”/Ancillary/Cars/Car”>
However, because you do not want to hardcode Cars, you may want to get this from the value of an attribute or another element. To do this, first put the element/attribute value into a variable (in this example I have called it $type) the XSL below is the same as the XSL above, assuming the $type is set to Car. This process automates loads of information for me and means I can create as many types as I like, with as many ancillary items as I need without have to hard code information in my XSLT to get it.
<xsl:for-each
select=”//Ancillary/*[name()=concat($type,’s’)]/*[name()=$type]”>
‘Big up’ to Matt for help with this. Madrid in four days!!!!