The .. is often combined with the attribute axis to find the attribute of the parent node (../@name).
You can use an asterisk as a wildcard within the path.
For example, /*/A would select all the A elements of all of the siblings of the current node.
File: Data.xml
<?xml version="1.0"?>
<employee>
<name language="English">T1</name>
<name language="Latin">T2</name>
<projects>
<project>project1</project>
<project>destruction</project>
<project>medicine</project>
</projects>
<weight>3 points</weight>
</employee>
File: Transform.xslt
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="projects">
<ul>
<xsl:value-of select="../name[@language='English']" />
<xsl:for-each select="project">
<li>
<xsl:value-of select="." />
</li>
</xsl:for-each>
</ul>
</xsl:template>
</xsl:stylesheet>
Output:
<?xml version="1.0" encoding="UTF-8"?>
T1
T2
<ul>T1<li>project1</li><li>destruction</li><li>
medicine
</li></ul>
3 points
|