XML выглядит приблизительно так:
<informationsystem_group id="10">
<parent_id>0</parent_id>
<name>Китай</name>
</informationsystem_group>
<informationsystem_group id="9">
<parent_id>0</parent_id>
<name>Россия</name>
<informationsystem_group id="11">
<parent_id>9</parent_id>
<name>Санкт-Петербург</name>
</informationsystem_group>
<informationsystem_group id="12">
<parent_id>9</parent_id>
<name>Москва</name>
<informationsystem_group id="13">
<parent_id>12</parent_id>
<name>Центр</name>
</informationsystem_group>
<informationsystem_group id="14">
<parent_id>12</parent_id>
<name>МКАД</name>
</informationsystem_group>
</informationsystem_group>
</informationsystem_group>
<informationsystem_item id="100">
<informationsystem_group_id>13</informationsystem_group_id>
<name>Красная площадь</name>
</informationsystem_item>
Списки групп вывожу так:
<xsl:apply-templates select='informationsystem_group'/>
<xsl:apply-templates select='informationsystem_group/informationsystem_group'/>
<xsl:apply-templates select='informationsystem_group/informationsystem_group/informationsystem_group'/>
<xsl:template match="informationsystem_group">
<xsl:value-of disable-output-escaping="yes" select="name"/>
</xsl:template>
Первый вопрос собственно в том, как обращаться к подгруппам более элегантно, чем три раза подряд колбасу из informationsystem_group составлять.
Второй вопрос в том, что мне нужно вывести своего рода дерево, причем состоящее только из групп, которые имеют дочерние группы или элементы. То есть нужно получить для данного примера нечто вроде:
<p>Россия</p>
<p>Россия -> Москва</p>
<p>Россия -> Москва -> Центр</p>
Значения "Китай", "Санкт-Петербург" и "МКАД" не выводятся, так как не имеют дочерних элементов.
С XSLT ранее не работал, помогите кто чем может, пожалуйста.