Changeset 427 for draft-ietf-httpbis/latest/abnf2xml2rfc.xslt
- Timestamp:
- 22/11/08 18:21:16 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
draft-ietf-httpbis/latest/abnf2xml2rfc.xslt
r425 r427 1 1 <xsl:transform 2 2 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 3 version="2.0"> 3 xmlns:xs="http://www.w3.org/2001/XMLSchema" 4 xmlns:x="http://purl.org/net/xml2rfc/ext" 5 version="2.0" 6 exclude-result-prefixes="xs"> 4 7 5 <xsl:output method="xml" omit-xml-declaration="yes" indent=" yes"/>6 8 <xsl:output method="xml" omit-xml-declaration="yes" indent="no"/> 9 7 10 <xsl:param name="abnf"/> 8 11 9 12 <xsl:template match="/"> 13 <xsl:variable name="src" select="."/> 10 14 <xsl:variable name="collected" select="unparsed-text($abnf)"/> 11 15 12 < section title="Collected ABNF" anchor="collected.abnf">13 <figure> 14 < artwork type="abnf" name="{$abnf}">16 <xsl:variable name="lines" as="xs:string*" select="tokenize($collected, '\r?\n')"/> 17 18 <section title="Collected ABNF" anchor="collected.abnf"> 15 19 <xsl:text> </xsl:text> 16 <xsl:value-of select="translate($collected,' ','')"/> 17 </artwork> 18 </figure> 20 <figure> 21 <xsl:text> </xsl:text> 22 <artwork type="abnf" name="{$abnf}"> 23 <xsl:for-each select="$lines"> 24 <xsl:variable name="lineno" select="position()"/> 25 <xsl:variable name="sc1" select="substring(.,1,1)"/> 26 <xsl:variable name="sc0" select="substring($lines[$lineno - 1],1,1)"/> 27 <xsl:if test="$sc1!=' ' and $sc0!=' ' and $sc1!=$sc0"> 28 <xsl:text> </xsl:text> 29 </xsl:if> 30 <xsl:analyze-string select="." regex='^([A-Za-z0-9\-]+) = ' flags="sm"> 31 <xsl:matching-substring> 32 <xsl:variable name="term" select="regex-group(1)"/> 33 <xsl:choose> 34 <xsl:when test="$src//*[@anchor=$term] or $src//x:anchor-alias[@value=$term]"> 35 <x:ref><xsl:value-of select="$term"/></x:ref> 36 </xsl:when> 37 <xsl:otherwise> 38 <xsl:value-of select="$term"/> 39 </xsl:otherwise> 40 </xsl:choose> 41 <xsl:text> = </xsl:text> 42 </xsl:matching-substring> 43 <xsl:non-matching-substring> 44 <xsl:value-of select="."/> 45 </xsl:non-matching-substring> 46 </xsl:analyze-string> 47 <xsl:text> </xsl:text> 48 </xsl:for-each> 49 </artwork> 50 <xsl:text> </xsl:text> 51 </figure> 52 <xsl:text> </xsl:text> 19 53 </section> 20 54
Note: See TracChangeset
for help on using the changeset viewer.