<p><del>It was be</del> <del>For</del> When we applied to Your Excellency for leave to adjourn it was because we foresaw that we <del>were</del> <add>should continue</add> wasting our own time ... </p>
<del>It was be</del> ⇒ deleted(e234).
<p lang="en">It was be ...</p>
⇒ lang(e345,"en").
paragraph(____). deleted(_____).
<doc lang="en"> <p>Wittgenstein wrote: <q lang="de"><ital>Die Welt ist alles, was der Fall ist.</ital></q> It is hard to escape, at first reading, the suspicion that Wittgenstein is guilty here of a gross platitude; it is only after reading the rest of the <bibl> <title lang="la">Tractatus</title> </bibl> that on returning to its famous first sentence one appreciates the depths of its intension.</p> </doc>
node(n1, element(doc)). path(n1,[1]). attr(n1, lang, "en"). node(n3, pcdata(" ")). path(n3,[1,1]). node(n4, element(p)). path(n4,[1,1,2]). node(n5, pcdata("Wittgenstein wrote: ")). path(n5,[1,1,1]). node(n6, element(q)). path(n6,[1,1,1,2]). attr(n6, lang, "de"). node(n8, element(ital)). path(n8,[1,1,1,1,1]). node(n9, pcdata("Die Welt ist alles, was der Fall ist.")). path(n9,[1,1,1,1,1]). node(n10, pcdata(" It is hard to escape, at first reading, the suspicion that Wittgenstein is guilty here of a gross platitude; it is only after reading the rest of the ")). path(n10,[1,1,3]). node(n11, element(title)). path(n11,[1,1,2,4]). attr(n11, lang, "la"). node(n13, pcdata("Tractatus")). path(n13,[1,1,2,1]). node(n14, pcdata(" that on returning to its famous first sentence one appreciates the depths of its intension.")). path(n14,[1,1,5]). node(n15, pcdata(" ")). path(n15,[1,3]).
<doc lang="en"> <p>Wittgenstein wrote: <q lang="de"><ital>Die Welt ist alles, was der Fall ist.</ital></q> It is hard to escape, at first reading, the suspicion that Wittgenstein is guilty here of a gross platitude; it is only after reading the rest of the <title lang="la">Tractatus</title> that on returning to its famous first sentence one appreciates the depths of its intension.</p> </doc>
<xsl:template name="element"> <xsl:text>node(</xsl:text> <xsl:value-of select="generate-id(.)"/> <xsl:text>, element(</xsl:text> <xsl:value-of select="name()"/> <xsl:text>)).
</xsl:text> <xsl:choose> <xsl:when test="../.."> <!--* when we have a parent which has a parent, say who it is *--> <xsl:text>parent-child(</xsl:text> <xsl:value-of select="generate-id(..)"/> <xsl:text>, </xsl:text> <xsl:value-of select="generate-id(.)"/> <xsl:text>).
</xsl:text> <xsl:text>path(</xsl:text> <xsl:value-of select="generate-id(.)"/> <xsl:text>,[</xsl:text> <xsl:number level="multiple" count="*" format="1,1" /> <xsl:text>,</xsl:text> <xsl:value-of select="position()" /> <xsl:text>]).
</xsl:text> </xsl:when> <xsl:otherwise> <!--* when we have a parent which is an element, say who it is *--> <xsl:text>document-element(</xsl:text> <!--* <xsl:value-of select="./@id"/> *--> <xsl:value-of select="generate-id(.)"/> <xsl:text>).
</xsl:text> </xsl:otherwise> </xsl:choose> <xsl:text>
</xsl:text> <xsl:for-each select="@*"> <xsl:call-template name="attribute"/> </xsl:for-each> </xsl:template>
node(n1, element(doc)). path(n1,[1]). attr(n1, lang, "en"). node(n3, pcdata(" ")). path(n3,[1,1]). node(n4, element(p)). path(n4,[1,1,2]). node(n5, pcdata("Wittgenstein wrote: ")). path(n5,[1,1,1]). node(n6, element(q)). path(n6,[1,1,1,2]). attr(n6, lang, "de"). node(n8, element(ital)). path(n8,[1,1,1,1,1]). node(n9, pcdata("Die Welt ist alles, was der Fall ist.")). path(n9,[1,1,1,1,1]). node(n10, pcdata(" It is hard to escape, at first reading, the suspicion that Wittgenstein is guilty here of a gross platitude; it is only after reading the rest of the ")). path(n10,[1,1,3]). node(n11, element(title)). path(n11,[1,1,2,4]). attr(n11, lang, "la"). node(n13, pcdata("Tractatus")). path(n13,[1,1,2,1]). node(n14, pcdata(" that on returning to its famous first sentence one appreciates the depths of its intension.")). path(n14,[1,1,5]). node(n15, pcdata(" ")). path(n15,[1,3]).
<attribute match="@lang"> <doc> <p>If an element has a <ident>lang</ident> attribute, the attribute value names the language of the element's content (unless overridden).</p> </doc> <rule distributed="true" lang="Prolog"> lang(<de xv="../@id"/>,.) :- !. </rule> <doc> <p>Otherwise, the language is the same as that of the parent element.</p> </doc> <rule distributed="false" lang="Prolog"> lang(E,L) :- parent(P,E), lang(P,L). </rule> </attribute>
lang({../@id,.}) :- !.
lang(E,L) :- parent(P,E), lang(P,L).
lang(E,L) :- parent(P,E), lang(P,L).
<xsl:template name="calc-lang"> lang( <xsl:value-of select="generate-id(.)"/> , <xsl:call-template name="inherit-lang"/> ). </xsl:template> <xsl:template name="inherit-lang"> <xsl:choose> <xsl:when select="@lang"> <xsl:value-of select="@lang"/> </xsl:when> <xsl:otherwise> <xsl:for-each select=".."> <xsl:call-template name="inherit-lang"/> </xsl:for-each> </xsl:otherwise> </xsl:choose> </xsl:template> <!--* can you find the bug here? *-->