Skip to content

Commit bb021aa

Browse files
committed
🐛 The dataref.xslt transform has some bugs
- resolves brianary#41
1 parent e57e058 commit bb021aa

File tree

2 files changed

+43
-26
lines changed

2 files changed

+43
-26
lines changed

dataref.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@ th.notes, td.notes { min-width: 3em; max-width: 40%; }
1818
.notes { color: green; font-style: italic; }
1919
td.notes p, td.notes table { margin: 1ex; }
2020
th.direction { font: caption; font-style: italic; }
21-
th,td { vertical-align: top; }
21+
th,td { padding: 2pt 1ex; vertical-align: top; }
2222
ul { padding-top: 0; padding-bottom: 0; margin-top: 0; margin-bottom: 0; }
2323
li.space { color: #28A; }
2424
div.index ul { list-style-type: none; margin: 0 0 0 1em; padding: 0; }
2525
div.index li { list-style-type: none; margin: 0; padding: 0; }
2626
ul.typefields { -moz-column-width: 18em; -moz-column-gap: 1em; column-width: 18em; column-gap: 1em; }
27+
code { font-family:'Courier New', Courier, monospace; font-size: 100%; }
2728
@media screen
2829
{
2930
html { background-color: appworkspace; }

dataref.xslt

Lines changed: 41 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -111,16 +111,16 @@ This stylesheet builds a list of all of the services, ports, and messages (for W
111111
</xsl:template>
112112

113113
<xsl:template match="xs:simpleType" mode="root">
114-
<h2 class="simpleType"><xsl:value-of select="@name"/></h2>
114+
<h2 class="simpleType"><xsl:value-of select="concat(@name,' ',local-name())"/></h2>
115115
<xsl:apply-templates select="xs:attribute,* except xs:attribute"/>
116116
</xsl:template>
117117

118118
<xsl:template match="xs:complexType" mode="root">
119-
<h2 class="complexType"><xsl:value-of select="@name"/></h2>
119+
<h2 class="complexType"><xsl:value-of select="concat(@name,' ',local-name())"/></h2>
120120
<table><caption><xsl:value-of select="@name"/></caption>
121121
<thead><tr><th>Name</th><th title="Occurrances" class="occurs">#</th>
122122
<th>Type</th><th class="notes" title="Notes">📝</th></tr></thead>
123-
<tbody><xsl:apply-templates select="xs:attribute,* except xs:attribute"/></tbody>
123+
<tbody><xsl:apply-templates select="xs:attribute,* except xs:attribute" mode="tr"/></tbody>
124124
</table>
125125
</xsl:template>
126126

@@ -129,7 +129,7 @@ This stylesheet builds a list of all of the services, ports, and messages (for W
129129
<xsl:variable name="type" select="if (@type) then resolve-QName(@type,.) else ()" as="xs:QName?"/>
130130
<xsl:variable name="complexType" select="if (xs:complexType) then xs:complexType
131131
else if (exists($type)) then $schema/xs:complexType[QName($tns,@name) eq $type] else ()" as="element()*"/>
132-
<h2 class="element-or-attribute"><xsl:value-of select="local-name()" /></h2>
132+
<h2 class="element-or-attribute"><xsl:value-of select="if ($name) then concat($name,' ',local-name()) else local-name()" /></h2>
133133
<table><caption><xsl:value-of select="local-name()"/></caption>
134134
<thead><tr><th>Name</th><th title="Occurrances" class="occurs">#</th>
135135
<th>Type</th><th class="notes" title="Notes">📝</th></tr></thead><tbody>
@@ -157,7 +157,9 @@ This stylesheet builds a list of all of the services, ports, and messages (for W
157157
</td>
158158
<td class="notes"><xsl:if test="xs:annotation"><details><summary>📝</summary>
159159
<xsl:apply-templates select="xs:annotation"/></details></xsl:if></td></tr>
160-
<xsl:apply-templates select="$schema/xs:element[QName($tns,@name) = $element]"/>
160+
<xsl:apply-templates select="$schema/xs:element[QName($tns,@name) = $element]" mode="tr">
161+
<xsl:with-param name="depth" select="2"/>
162+
</xsl:apply-templates>
161163
</xsl:when>
162164
<xsl:when test="exists($type) and x:in-xs($type)">
163165
<tr><td><xsl:value-of select="$name"/></td>
@@ -172,7 +174,9 @@ This stylesheet builds a list of all of the services, ports, and messages (for W
172174
<td><xsl:value-of select="($type,@name)[1]"/></td>
173175
<td class="notes"><xsl:if test="xs:annotation"><details><summary>📝</summary>
174176
<xsl:apply-templates select="xs:annotation"/></details></xsl:if></td></tr>
175-
<xsl:apply-templates select="xs:attribute,$complexType"/>
177+
<xsl:apply-templates select="xs:attribute,$complexType" mode="tr">
178+
<xsl:with-param name="depth" select="2"/>
179+
</xsl:apply-templates>
176180
</xsl:otherwise>
177181
</xsl:choose>
178182
</tbody>
@@ -261,12 +265,12 @@ This stylesheet builds a list of all of the services, ports, and messages (for W
261265
<table class="{$name}"><caption><xsl:value-of select="$name"/></caption>
262266
<thead><tr><th>Name</th><th title="Occurrances" class="occurs">#</th>
263267
<th>Type</th><th class="notes" title="Notes">📝</th></tr></thead>
264-
<xsl:apply-templates select="$part"/>
268+
<xsl:apply-templates select="$part" mode="tbody"/>
265269
</table>
266270
</xsl:if>
267271
</xsl:template>
268272

269-
<xsl:template match="wsdl:part">
273+
<xsl:template match="wsdl:part" mode="tbody">
270274
<xsl:variable name="type" select="if (@type) then resolve-QName(@type,.) else ()" as="xs:QName?"/>
271275
<xsl:choose>
272276
<xsl:when test="exists($type)">
@@ -281,13 +285,13 @@ This stylesheet builds a list of all of the services, ports, and messages (for W
281285
<td><xsl:value-of select="@type"/></td></tr></tbody>
282286
</xsl:when>
283287
<xsl:otherwise>
284-
<tbody><xsl:apply-templates select="$complexType"/></tbody>
288+
<tbody><xsl:apply-templates select="$complexType" mode="tr"/></tbody>
285289
</xsl:otherwise>
286290
</xsl:choose>
287291
</xsl:when>
288292
<xsl:otherwise>
289293
<xsl:variable name="element" select="resolve-QName(@element,.)" as="xs:QName"/>
290-
<tbody><xsl:apply-templates select="$schema/xs:element[QName($tns,@name) eq $element]"/></tbody>
294+
<tbody><xsl:apply-templates select="$schema/xs:element[QName($tns,@name) eq $element]" mode="tr"/></tbody>
291295
</xsl:otherwise>
292296
</xsl:choose>
293297
</xsl:template>
@@ -296,8 +300,16 @@ This stylesheet builds a list of all of the services, ports, and messages (for W
296300
<xsl:apply-templates select="x:ref-or-self(.)"/>
297301
</xsl:template>
298302

299-
<xsl:template match="xs:element|xs:attribute">
300-
<xsl:param name="depth" select="0" as="xs:integer" tunnel="yes"/>
303+
<xsl:template match="xs:element[@ref]|xs:attribute[@ref]|xs:group[@ref]" mode="tr">
304+
<xsl:apply-templates select="x:ref-or-self(.)" mode="tr"/>
305+
</xsl:template>
306+
307+
<xsl:template match="xs:complexType|xs:complexContent|xs:extension|xs:sequence" mode="tr">
308+
<xsl:apply-templates mode="tr"/>
309+
</xsl:template>
310+
311+
<xsl:template match="xs:element|xs:attribute" mode="tr">
312+
<xsl:param name="depth" select="1" as="xs:integer" tunnel="yes"/>
301313
<xsl:variable name="name" select="if (self::xs:attribute) then concat('@',@name) else @name" as="xs:string?"/>
302314
<xsl:variable name="type" select="if (@type) then resolve-QName(@type,.) else ()" as="xs:QName?"/>
303315
<xsl:variable name="complexType" select="if (xs:complexType) then xs:complexType
@@ -326,7 +338,7 @@ This stylesheet builds a list of all of the services, ports, and messages (for W
326338
</td>
327339
<td class="notes"><xsl:if test="xs:annotation"><details><summary>📝</summary>
328340
<xsl:apply-templates select="xs:annotation"/></details></xsl:if></td></tr>
329-
<xsl:apply-templates select="$schema/xs:element[QName($tns,@name) = $element]">
341+
<xsl:apply-templates select="$schema/xs:element[QName($tns,@name) = $element]" mode="tr">
330342
<xsl:with-param name="depth" select="$depth +1" as="xs:integer" tunnel="yes"/>
331343
</xsl:apply-templates>
332344
</xsl:when>
@@ -343,7 +355,7 @@ This stylesheet builds a list of all of the services, ports, and messages (for W
343355
<td><xsl:value-of select="($type,@name)[1]"/></td>
344356
<td class="notes"><xsl:if test="xs:annotation"><details><summary>📝</summary>
345357
<xsl:apply-templates select="xs:annotation"/></details></xsl:if></td></tr>
346-
<xsl:apply-templates select="xs:attribute,$complexType">
358+
<xsl:apply-templates select="xs:attribute,$complexType" mode="tr">
347359
<xsl:with-param name="depth" select="$depth +1" as="xs:integer" tunnel="yes"/>
348360
</xsl:apply-templates>
349361
</xsl:otherwise>
@@ -354,18 +366,17 @@ This stylesheet builds a list of all of the services, ports, and messages (for W
354366
<xsl:apply-templates/>
355367
</xsl:template>
356368

357-
<xsl:template match="xs:schema/xs:*/xs:annotation/xs:documentation">
358-
<tr><td colspan="4"><p class="notes">📝 <xsl:value-of select="." /></p></td></tr>
359-
</xsl:template>
369+
<xsl:template match="xs:schema/xs:*/xs:annotation" mode="tr"/>
370+
<xsl:template match="xs:schema/xs:*/xs:annotation/xs:documentation" mode="tr"/>
360371

361-
<xsl:template match="xs:any">
372+
<xsl:template match="xs:any" mode="tr">
362373
<xsl:param name="depth" select="0" as="xs:integer" tunnel="yes"/>
363374
<tr><th class="direction" style="padding-left:{$depth}em">(anything)</th>
364375
<td class="occurs"><xsl:call-template name="occurs"/></td>
365376
<td><xsl:value-of select="@id"/></td></tr>
366377
</xsl:template>
367378

368-
<xsl:template match="xs:choice">
379+
<xsl:template match="xs:choice" mode="tr">
369380
<xsl:param name="depth" select="0" as="xs:integer" tunnel="yes"/>
370381
<tr><th class="direction" style="padding-left:{$depth}em">Choose one:</th>
371382
<td class="occurs"><xsl:call-template name="occurs"/></td>
@@ -376,7 +387,7 @@ This stylesheet builds a list of all of the services, ports, and messages (for W
376387
<tr><th class="direction" style="padding-left:{$depth}em">end choice.</th></tr>
377388
</xsl:template>
378389

379-
<xsl:template match="xs:group[(@minOccurs and @minOccurs ne '1') or (@maxOccurs and @maxOccurs ne '1')]">
390+
<xsl:template match="xs:group[(@minOccurs and @minOccurs ne '1') or (@maxOccurs and @maxOccurs ne '1')]" mode="tr">
380391
<xsl:param name="depth" select="0" as="xs:integer" tunnel="yes"/>
381392
<tr><th class="direction" style="padding-left:{$depth}em">Group:</th>
382393
<td class="occurs"><xsl:call-template name="occurs"/></td>
@@ -387,7 +398,7 @@ This stylesheet builds a list of all of the services, ports, and messages (for W
387398
<tr><th class="direction" style="padding-left:{$depth}em">end group.</th></tr>
388399
</xsl:template>
389400

390-
<xsl:template match="xs:sequence[(@minOccurs and @minOccurs ne '1') or (@maxOccurs and @maxOccurs ne '1')]">
401+
<xsl:template match="xs:sequence[(@minOccurs and @minOccurs ne '1') or (@maxOccurs and @maxOccurs ne '1')]" mode="tr">
391402
<xsl:param name="depth" select="0" as="xs:integer" tunnel="yes"/>
392403
<tr><th class="direction" style="padding-left:{$depth}em">Choose one:</th>
393404
<td class="occurs"><xsl:call-template name="occurs"/></td>
@@ -420,7 +431,7 @@ This stylesheet builds a list of all of the services, ports, and messages (for W
420431
<xsl:otherwise><p>A <code><xsl:value-of select="@base" /></code>, with the following restrictions:</p></xsl:otherwise>
421432
</xsl:choose>
422433
</xsl:if>
423-
<ul><xsl:if test="xs:enumeration and not(* except xs:enumeration)">
434+
<ul><xsl:if test="xs:enumeration and not(* except xs:enumeration) and not(xs:enumeration/xs:annotation/xs:documentation)">
424435
<xsl:attribute name="style">
425436
<xsl:text>columns:</xsl:text>
426437
<xsl:value-of select="max(for $enum in xs:enumeration/@value return string-length($enum))"/>
@@ -487,12 +498,17 @@ This stylesheet builds a list of all of the services, ports, and messages (for W
487498
</xsl:template>
488499

489500
<xsl:template match="xs:enumeration">
490-
<li><xsl:apply-templates select="xs:annotation/xs:documentation"/>
491-
<xsl:value-of select="@value"/></li>
501+
<li><code><xsl:value-of select="@value"/></code></li>
502+
</xsl:template>
503+
504+
<xsl:template match="xs:enumeration[xs:annotation/xs:documentation]">
505+
<li><details><summary><code><xsl:value-of select="@value"/></code></summary>
506+
<xsl:apply-templates select="xs:annotation/xs:documentation"/>
507+
</details></li>
492508
</xsl:template>
493509

494510
<xsl:template match="xs:enumeration/xs:annotation/xs:documentation">
495-
<xsl:attribute name="title"><xsl:value-of select="."/></xsl:attribute>
511+
<p class="notes">📝 <xsl:value-of select="."/></p>
496512
</xsl:template>
497513

498514
</xsl:transform>

0 commit comments

Comments
 (0)