Permalink
Browse files

re-doing the XPath case study with a better approach

git-svn-id: https://slps.svn.sourceforge.net/svnroot/slps@817 ab42f6e0-554d-0410-b580-99e487e6eeb2
  • Loading branch information...
grammarware committed Jul 11, 2010
1 parent 0ff5b88 commit ca2a84475de299a1ec84b69f3d967848071eb72a
Showing with 1,636 additions and 1 deletion.
  1. +1 −1 shared/xsd/ldf.xsd
  2. +2 −0 topics/documents/xpath/Makefile
  3. +80 −0 topics/documents/xpath/spec2ldf.xslt
  4. +1,553 −0 topics/documents/xpath/xmlspec-v20.dtd
View
@@ -178,7 +178,7 @@
<xsd:complexType>
<xsd:sequence>
<xsd:element name="title" type="xsd:string"/>
- <xsd:choice>
+ <xsd:choice minOccurs="0">
<xsd:element name="version" type="xsd:string"/>
<xsd:element name="edition" type="xsd:string"/>
</xsd:choice>
@@ -1,8 +1,10 @@
build:
+ 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
clean:
*~
@@ -0,0 +1,80 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:bgf="http://planet-sl.org/bgf" xmlns:ldf="http://planet-sl.org/ldf" version="1.0">
+ <xsl:output method="xml" encoding="UTF-8"/>
+ <xsl:template match="/spec">
+ <ldf:document xmlns:ldf="http://planet-sl.org/ldf">
+ <ldf:title-page>
+ <xsl:if test="header/w3c-doctype">
+ <ldf:body>w3c</ldf:body>
+ <number>
+ <xsl:value-of select="header/w3c-designation"/>
+ </number>
+ </xsl:if>
+ <ldf:metainfo>
+ <xsl:copy-of select="header/title"/>
+ <xsl:for-each select="header/authlist/author">
+ <author>
+ <xsl:value-of select="name"/>
+ </author>
+ </xsl:for-each>
+ </ldf:metainfo>
+ <xsl:choose>
+ <xsl:when test="header/w3c-doctype = 'W3C Recommendation'">
+ <ldf:status>approved</ldf:status>
+ </xsl:when>
+ <xsl:otherwise>
+ <ldf:status>unknown</ldf:status>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="header/version = 'Version 1.0'">
+ <version>1.0</version>
+ </xsl:when>
+ <xsl:when test="header/version = 'Version 2.0'">
+ <version>2.0</version>
+ </xsl:when>
+ <xsl:otherwise>
+ <version>
+ <xsl:value-of select="header/version"/>
+ </version>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:for-each select="header/prevlocs/loc">
+ <ldf:previous>
+ <title>
+ <xsl:choose>
+ <xsl:when test="substring(text(),1,7) = 'http://'">
+ <xsl:value-of select="substring-after(substring-after(substring-after(text(),'http://www.w3.org/'),'/'),'/')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="text()"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </title>
+ <uri>
+ <xsl:value-of select="@href"/>
+ </uri>
+ </ldf:previous>
+ </xsl:for-each>
+ <date>
+ <xsl:value-of select="header/pubdate/day"/>
+ <xsl:text> </xsl:text>
+ <xsl:value-of select="header/pubdate/month"/>
+ <xsl:text> </xsl:text>
+ <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>
+ </ldf:document>
+ </xsl:template>
+</xsl:stylesheet>
Oops, something went wrong.

0 comments on commit ca2a844

Please sign in to comment.