Created
January 19, 2011 06:23
-
-
Save osima/785777 to your computer and use it in GitHub Desktop.
xslで nbsp や u2029 を扱う方法
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
| <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> | |
| <xsl:output method="xml" indent="yes" encoding="UTF-8" /> | |
| <xsl:variable name="br"><xsl:text> </xsl:text></xsl:variable> <!-- u2029 --> | |
| <xsl:variable name="nbsp"><xsl:text> </xsl:text></xsl:variable> <!-- nbsp --> | |
| <!-- br to u2029 --> | |
| <xsl:template match="br"> | |
| <xsl:value-of select="$br"/> | |
| </xsl:template> | |
| <!-- blockquote --> | |
| <xsl:template match="blockquote"> | |
| <blockquote> | |
| <p aid:pstyle="blockquote"> | |
| <Image> | |
| <xsl:attribute name="href" >icons/<xsl:value-of select="@class" />.ai</xsl:attribute> | |
| <xsl:attribute name="position"><xsl:text>inline</xsl:text></xsl:attribute> | |
| </Image> | |
| </p> | |
| <xsl:apply-templates select="@*|node()" /> | |
| </blockquote> | |
| <p aid:pstyle="dummy"> | |
| </p> | |
| </xsl:template> | |
| <!-- step --> | |
| <xsl:template match="step"> | |
| <p aid:pstyle="step"> | |
| <Image> | |
| <xsl:attribute name="href">step/stepNum0<xsl:value-of select="@number" />.ai</xsl:attribute> | |
| <xsl:attribute name="position"><xsl:text>inline</xsl:text></xsl:attribute> | |
| </Image> | |
| <span aid:cstyle="nbsp"><xsl:text><xsl:value-of select="$nbsp"/></xsl:text></span> | |
| <xsl:apply-templates select="@*|node()" /> | |
| </p> | |
| </xsl:template> | |
| <xsl:template match="@*|node()" > | |
| <xsl:copy><xsl:apply-templates select="@*|node()" /></xsl:copy> | |
| </xsl:template> | |
| </xsl:stylesheet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment