As you can see, each <meeting> contains a <location-id> which references a <location> element defined elsewhere in the XML data. This is done to reduce redundancy and keep the document smaller.
In my stylesheet, I need to sort meetings by their location name. Here's my XSL:
Now this doesn't work. According to my parser, it appears that <xsl:sort> elements must come immediately <xsl:for-each> so I'm not able to declare the $location_id variable. Is there another way to accomplish what I'm trying to do?