Created
October 30, 2015 07:40
-
-
Save frogcat/b356d8917e000ea94bd5 to your computer and use it in GitHub Desktop.
SPARQL1.1Query の関数定義を抜いて Qiita の Markdown に整形するためのスタイルシート
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:h="http://www.w3.org/1999/xhtml"> | |
<xsl:output method="text" /> | |
<xsl:template match="/"> | |
<xsl:apply-templates select="//*[@id='SparqlOps']/../.." /> | |
</xsl:template> | |
<xsl:template match="*"> | |
<xsl:apply-templates select="*" /> | |
</xsl:template> | |
<xsl:template match="h:div[not(.//h:pre)]" /> | |
<xsl:template match="h:h4"> | |
<xsl:value-of select="string('# ')" /> | |
<xsl:value-of select="string('[')" /> | |
<xsl:value-of select="substring-after(string(.),' ')" /> | |
<xsl:value-of select="string(']')" /> | |
<xsl:value-of select="string('(')" /> | |
<xsl:value-of select="string('http://www.w3.org/TR/sparql11-query/#')" /> | |
<xsl:value-of select="h:a/@name" /> | |
<xsl:value-of select="string(')')" /> | |
<xsl:value-of select="string(' ')" /> | |
<xsl:value-of select="string(' ')" /> | |
<xsl:apply-templates select="*" /> | |
</xsl:template> | |
<xsl:template match="h:div[h:h5 and .//@class='prototype']"> | |
<xsl:value-of select="string('```:')" /> | |
<xsl:value-of select="translate(substring-after(string(h:h5),' '),' ','_')" /> | |
<xsl:value-of select="string(' ')" /> | |
<xsl:apply-templates select="*" /> | |
<xsl:value-of select="string('``` ')" /> | |
<xsl:value-of select="string(' ')" /> | |
</xsl:template> | |
<xsl:template match="h:pre[@class='prototype']"> | |
<xsl:value-of select="string(.)" /> | |
<xsl:value-of select="string(' ')" /> | |
</xsl:template> | |
</xsl:stylesheet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment