, for-each .
, XSLT ( ), . , for-each, .
XSLT , , . <xsl:for-each> 98% , , XSLT. XSLT, <xsl:for-each>, ( , ), :
<xsl:template match="Foundation.Core.Class">
<xsl:apply-templates select="
Foundation.Core.Classifier.feature/Foundation.Core.Attribute
" />
</xsl:template>
<xsl:template match="Foundation.Core.Attribute">
<owl:DatatypeProperty rdf:ID="{Foundation.Core.ModelElement.name}">
<rdfs:domain rdf:resource="{
ancestor::Foundation.Core.Class[1]/Foundation.Core.ModelElement.name[1]
}" />
</owl:DatatypeProperty>
</xsl:template>
( , , , .)
XPath ancestor , ( , <Foundation.Core.ModelElement.name> ).
PS: XML - . ... ... , , <Foundation.Core.Classifier.feature>. , - .
:
xmi.id/xmi.idref, - XSL-:
<xsl:key name="kElementByIdref" match="*[@xmi.id]" use="@xmi.id" />
<xsl:template match="Foundation.Core.DataType">
<dataTypeName>
<xsl:value-of select="key('kElementByIdref', @xmi.idref)" />
</dataTypeName>
</xsl:template>
, , , . , , JavaScript.