Skip to content

Commit

Permalink
outermost
Browse files Browse the repository at this point in the history
  • Loading branch information
HeikoTheissen committed Apr 15, 2024
1 parent 994f428 commit 4e28656
Showing 1 changed file with 42 additions and 24 deletions.
66 changes: 42 additions & 24 deletions tools/resolve-paths.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,6 @@
select="ancestor::edm:Annotations/@Target" />
</xsl:apply-templates>
</xsl:variable>
<xsl:variable name="first-segment"
select="substring-before(concat($target,' '),' ')" />
<xsl:variable name="final-segment">
<xsl:call-template name="name">
<xsl:with-param name="qname" select="$target" />
Expand All @@ -171,16 +169,19 @@
</xsl:variable>
<xsl:apply-templates select="."
mode="external-targeting">
<xsl:with-param name="root"
select="//edm:*[generate-id()=$first-segment]" />
<xsl:with-param name="target" select="$target" />
<xsl:with-param name="host"
select="//edm:*[generate-id()=$final-segment]" />
</xsl:apply-templates>
</xsl:template>

<xsl:template match="*" mode="external-targeting">
<xsl:param name="root" />
<xsl:param name="target" />
<xsl:param name="host" />
<xsl:variable name="first-segment"
select="substring-before(concat($target,' '),' ')" />
<xsl:variable name="root"
select="//edm:*[generate-id()=$first-segment]" />
<xsl:choose>
<xsl:when
test="$host/self::edm:Annotation or
Expand All @@ -189,7 +190,7 @@
$host/self::edm:PropertyValue">
<xsl:apply-templates select="."
mode="external-targeting">
<xsl:with-param name="root" select="$root" />
<xsl:with-param name="target" select="$target" />
<xsl:with-param name="host"
select="$host/ancestor-or-self::edm:Annotation" />
</xsl:apply-templates>
Expand All @@ -212,6 +213,16 @@
<xsl:with-param name="relative-to" select="$root" />
</xsl:apply-templates>
</xsl:when>
<xsl:when
test="$host/self::edm:Property or
$host/self::edm:NavigationProperty">
<xsl:apply-templates select="."
mode="external-targeting">
<xsl:with-param name="target"
select="substring-after($target,' ')" />
<xsl:with-param name="host" select="$host" />
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="." mode="eval-path">
<xsl:with-param name="relative-to" select="$host" />
Expand Down Expand Up @@ -244,6 +255,31 @@
</xsl:apply-templates>
</xsl:template>

<xsl:template match="edm:*/@Type | edm:*/@EntityType">
<xsl:apply-templates select="." mode="eval-path">
<xsl:with-param name="relative-to" select="." />
</xsl:apply-templates>
</xsl:template>

<xsl:template match="edm:PropertyRef/@Name">
<xsl:apply-templates select="." mode="eval-path">
<xsl:with-param name="relative-to" select="../../.." />
</xsl:apply-templates>
</xsl:template>

<xsl:template match="edm:NavigationPropertyBinding/@Path">
<xsl:apply-templates select="." mode="eval-path">
<xsl:with-param name="relative-to" select="../.." />
</xsl:apply-templates>
</xsl:template>

<xsl:template
match="edm:NavigationPropertyBinding/@Target">
<xsl:apply-templates select="." mode="eval-path">
<xsl:with-param name="relative-to" select="../../.." />
</xsl:apply-templates>
</xsl:template>

<xsl:template match="@*|*" mode="eval-path">
<xsl:param name="relative-to" />
<xsl:variable name="path">
Expand Down Expand Up @@ -297,24 +333,6 @@
</xsl:choose>
</xsl:template>

<xsl:template match="edm:PropertyRef/@Name">
<xsl:apply-templates select="." mode="eval-path">
<xsl:with-param name="relative-to" select="../../.." />
</xsl:apply-templates>
</xsl:template>

<xsl:template match="edm:NavigationPropertyBinding/@Path">
<xsl:apply-templates select="." mode="eval-path">
<xsl:with-param name="relative-to" select="../.." />
</xsl:apply-templates>
</xsl:template>

<xsl:template match="edm:NavigationPropertyBinding/@Target">
<xsl:apply-templates select="." mode="eval-path">
<xsl:with-param name="relative-to" select="../../.." />
</xsl:apply-templates>
</xsl:template>

<xsl:template match="@*|*" mode="path">
<xsl:param name="p" />
<xsl:choose>
Expand Down

0 comments on commit 4e28656

Please sign in to comment.