Skip to content

Commit

Permalink
more coverage of W3C-to-LDF extractor
Browse files Browse the repository at this point in the history
git-svn-id: https://slps.svn.sourceforge.net/svnroot/slps@818 ab42f6e0-554d-0410-b580-99e487e6eeb2
  • Loading branch information
grammarware committed Jul 12, 2010
1 parent ca2a844 commit 8d785b3
Show file tree
Hide file tree
Showing 4 changed files with 116 additions and 19 deletions.
2 changes: 1 addition & 1 deletion shared/tools/checkxml
Expand Up @@ -17,5 +17,5 @@ elif [ ! -r ${SLPS}/shared/xsd/$1.xsd ]; then
echo "Oops: schema for $1 not found or not readable."
exit 1
else
xmllint --noout --schema ${SLPS}/shared/xsd/$1.xsd $2
/usr/local/bin/xmllint --noout --schema ${SLPS}/shared/xsd/$1.xsd $2
fi
12 changes: 6 additions & 6 deletions shared/xsd/ldf.xsd
Expand Up @@ -849,12 +849,12 @@
<xsd:element name="link">
<xsd:annotation>
<xsd:documentation>
Internal links are pairs of text that will become clickable in hypertext
presentation forms or precede the reference itself when this is the only
option. The reference points to a section or a subsection of the same
document that the link should refer to. If the explicit text is omitted,
its default value is the name of the section being referenced.
</xsd:documentation>
Internal links are pairs of text that will become clickable in hypertext
presentation forms or precede the reference itself when this is the only
option. The reference points to a section or a subsection of the same
document that the link should refer to. If the explicit text is omitted,
its default value is the name of the section being referenced.
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
Expand Down
5 changes: 4 additions & 1 deletion topics/documents/xpath/Makefile
@@ -1,10 +1,13 @@
build:
xsltproc spec2ldf.xslt xpath-pp.xml > xpath1.ldf
/usr/local/bin/xsltproc spec2ldf.xslt xpath-pp.xml > xpath1.ldf

get:
curl -k http://www.w3.org/TR/1999/REC-xpath-19991116.xml >xpath1.xml
curl -k http://www.w3.org/TR/2007/REC-xpath20-20070123/xpath20.xml >xpath2.xml
curl -k http://www.w3.org/XML/1998/06/xmlspec-v20.dtd > xmlspec-v20.dtd

test:
../../../shared/tools/checkxml ldf xpath1.ldf

clean:
*~
116 changes: 105 additions & 11 deletions topics/documents/xpath/spec2ldf.xslt
Expand Up @@ -64,17 +64,111 @@
<xsl:value-of select="header/pubdate/year"/>
</date>
</ldf:title-page>
<ldf:part>
<role>front-matter</role>
<ldf:metainfo>
<title>Status of this document</title>
</ldf:metainfo>
<content>
<simple-section>
<xsl:copy-of select="header/status"/>
</simple-section>
</content>
</ldf:part>
<content>
<ldf:part>
<role>front-matter</role>
<ldf:metainfo/>
<content>
<ldf:simple-section>
<role>scope</role>
<ldf:metainfo>
<title>Status of this document</title>
</ldf:metainfo>
<content>
<xsl:for-each select="header/status/p">
<text>
<xsl:apply-templates select="node()"/>
</text>
</xsl:for-each>
</content>
</ldf:simple-section>
<ldf:simple-section>
<role>abstract</role>
<ldf:metainfo/>
<content>
<xsl:for-each select="header/abstract/p">
<text>
<xsl:apply-templates select="node()"/>
</text>
</xsl:for-each>
</content>
</ldf:simple-section>
<!-- skipped: langusage, revisiondesc -->
<ldf:placeholder>list-of-contents</ldf:placeholder>
</content>
</ldf:part>
<ldf:part>
<role>core-part</role>
<ldf:metainfo/>
<content>
<xsl:for-each select="body/div1">
<xsl:choose>
<xsl:when test="head = 'Introduction'">
<ldf:simple-section>
<role>foreword</role>
<ldf:metainfo>
<xsl:if test="@id">
<id>
<xsl:value-of select="@id"/>
</id>
</xsl:if>
<title>
<xsl:value-of select="head"/>
</title>
</ldf:metainfo>
<content>
<xsl:for-each select="*[local-name() != 'head']">
<text>
<xsl:apply-templates select="node()"/>
</text>
</xsl:for-each>
</content>
</ldf:simple-section>
</xsl:when>
<xsl:otherwise>
<ldf:structured-section>
<ldf:metainfo>
<xsl:if test="@id">
<id>
<xsl:value-of select="@id"/>
</id>
</xsl:if>
<title>
<xsl:value-of select="head"/>
</title>
</ldf:metainfo>
<content>
<ldf:normative-role>description</ldf:normative-role>
<ldf:simple-section>
<role>abstract</role><!-- TODO -->
<ldf:metainfo/>
<content>
<xsl:for-each select="*[local-name() != 'head']">
<text>
<xsl:apply-templates select="node()"/>
</text>
</xsl:for-each>
</content>
</ldf:simple-section>
</content>
</ldf:structured-section>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</content>
</ldf:part>
</content>
</ldf:document>
</xsl:template>
<!-- neglecting xlink, show, actuate properties-->
<xsl:template match="loc">
<ldf:link>
<text>
<xsl:value-of select="text()"/>
</text>
<external>
<xsl:value-of select="@href"/>
</external>
</ldf:link>
</xsl:template>
</xsl:stylesheet>

0 comments on commit 8d785b3

Please sign in to comment.