Skip to content

Commit

Permalink
DTD
Browse files Browse the repository at this point in the history
  • Loading branch information
HeikoTheissen committed Apr 17, 2024
1 parent 8ac3b6c commit 8dba89b
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 13 deletions.
71 changes: 71 additions & 0 deletions tools/csdl-ext.dtd
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<!ATTLIST Schema id ID #IMPLIED>
<!ATTLIST Annotations id ID #IMPLIED>
<!ATTLIST EntityType id ID #IMPLIED>
<!ATTLIST Key id ID #IMPLIED>
<!ATTLIST PropertyRef id ID #IMPLIED>
<!ATTLIST Property id ID #IMPLIED>
<!ATTLIST NavigationProperty id ID #IMPLIED>
<!ATTLIST ReferentialConstraint id ID #IMPLIED>
<!ATTLIST OnDelete id ID #IMPLIED>
<!ATTLIST ComplexType id ID #IMPLIED>
<!ATTLIST EnumType id ID #IMPLIED>
<!ATTLIST Member id ID #IMPLIED>
<!ATTLIST TypeDefinition id ID #IMPLIED>
<!ATTLIST Action id ID #IMPLIED>
<!ATTLIST Function id ID #IMPLIED>
<!ATTLIST ReturnType id ID #IMPLIED>
<!ATTLIST Parameter id ID #IMPLIED>
<!ATTLIST EntityContainer id ID #IMPLIED>
<!ATTLIST EntitySet id ID #IMPLIED>
<!ATTLIST Singleton id ID #IMPLIED>
<!ATTLIST NavigationPropertyBinding id ID #IMPLIED>
<!ATTLIST ActionImport id ID #IMPLIED>
<!ATTLIST FunctionImport id ID #IMPLIED>
<!ATTLIST Term id ID #IMPLIED>
<!ATTLIST Annotation id ID #IMPLIED>
<!ATTLIST Binary id ID #IMPLIED>
<!ATTLIST Bool id ID #IMPLIED>
<!ATTLIST Date id ID #IMPLIED>
<!ATTLIST DateTimeOffset id ID #IMPLIED>
<!ATTLIST Decimal id ID #IMPLIED>
<!ATTLIST Duration id ID #IMPLIED>
<!ATTLIST EnumMember id ID #IMPLIED>
<!ATTLIST Float id ID #IMPLIED>
<!ATTLIST Guid id ID #IMPLIED>
<!ATTLIST Int id ID #IMPLIED>
<!ATTLIST String id ID #IMPLIED>
<!ATTLIST TimeOfDay id ID #IMPLIED>
<!ATTLIST AnnotationPath id ID #IMPLIED>
<!ATTLIST ModelElementPath id ID #IMPLIED>
<!ATTLIST NavigationPropertyPath id ID #IMPLIED>
<!ATTLIST PropertyPath id ID #IMPLIED>
<!ATTLIST Path id ID #IMPLIED>
<!ATTLIST And id ID #IMPLIED>
<!ATTLIST Or id ID #IMPLIED>
<!ATTLIST Not id ID #IMPLIED>
<!ATTLIST Eq id ID #IMPLIED>
<!ATTLIST Ne id ID #IMPLIED>
<!ATTLIST Gt id ID #IMPLIED>
<!ATTLIST Ge id ID #IMPLIED>
<!ATTLIST Lt id ID #IMPLIED>
<!ATTLIST Le id ID #IMPLIED>
<!ATTLIST Has id ID #IMPLIED>
<!ATTLIST In id ID #IMPLIED>
<!ATTLIST Neg id ID #IMPLIED>
<!ATTLIST Add id ID #IMPLIED>
<!ATTLIST Sub id ID #IMPLIED>
<!ATTLIST Mul id ID #IMPLIED>
<!ATTLIST Div id ID #IMPLIED>
<!ATTLIST DivBy id ID #IMPLIED>
<!ATTLIST Mod id ID #IMPLIED>
<!ATTLIST Apply id ID #IMPLIED>
<!ATTLIST Cast id ID #IMPLIED>
<!ATTLIST Collection id ID #IMPLIED>
<!ATTLIST If id ID #IMPLIED>
<!ATTLIST UrlRef id ID #IMPLIED>
<!ATTLIST LabeledElement id ID #IMPLIED>
<!ATTLIST LabeledElementReference id ID #IMPLIED>
<!ATTLIST Null id ID #IMPLIED>
<!ATTLIST Record id ID #IMPLIED>
<!ATTLIST PropertyValue id ID #IMPLIED>
<!ATTLIST UrlRef id ID #IMPLIED>
28 changes: 19 additions & 9 deletions tools/resolve-paths.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
xmlns:p1="http://docs.oasis-open.org/odata/ns/edm/final-segment"
exclude-result-prefixes="edm">
<xsl:strip-space elements="*" />
<xsl:output method="xml" indent="yes" />
<xsl:output doctype-system="csdl-ext.dtd" method="xml"
indent="yes" />

<xsl:template match="/">
<xsl:apply-templates select="." mode="ids" />
Expand Down Expand Up @@ -462,14 +463,23 @@

<xsl:template match="*" mode="path-remainder">
<xsl:param name="p" />
<xsl:value-of select="generate-id()" />
<xsl:if test="contains($p,'/')">
<xsl:text> </xsl:text>
<xsl:apply-templates select="." mode="path">
<xsl:with-param name="p"
select="substring-after($p,'/')" />
</xsl:apply-templates>
</xsl:if>
<xsl:choose>
<xsl:when test="contains($p,'/')">
<xsl:variable name="remainder">
<xsl:apply-templates select="." mode="path">
<xsl:with-param name="p"
select="substring-after($p,'/')" />
</xsl:apply-templates>
</xsl:variable>
<xsl:if test="string($remainder)">
<xsl:value-of
select="concat(generate-id(),' ',$remainder)" />
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="generate-id()" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>

</xsl:stylesheet>
10 changes: 6 additions & 4 deletions tools/tests/annotations-v4.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,12 @@
<NavigationProperty Name="Header"
Type="self.Order" />
</EntityType>
<EntitySet Name="Orders" EntityType="self.Order"/>
<EntitySet Name="OrderItems" EntityType="self.OrderItem">
<NavigationPropertyBinding Path="Header" Target="Orders"/>
</EntitySet>
<EntityContainer Name="Container">
<EntitySet Name="Orders" EntityType="self.Order"/>
<EntitySet Name="OrderItems" EntityType="self.OrderItem">
<NavigationPropertyBinding Path="Header" Target="Orders"/>
</EntitySet>
</EntityContainer>
<Annotations Target="self.OrderItem/ID">
<Annotation Term="Core.Description">
<Path>Text</Path>
Expand Down

0 comments on commit 8dba89b

Please sign in to comment.