沒有在這裏不少方面去,但這應該幫助:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="*[@font-size < 34]">
<xsl:comment>
<xsl:text>What is this?</xsl:text>
<xsl:text>A font for ants?</xsl:text>
<xsl:text>How can we be expected to teach children to learn how to read...</xsl:text>
<xsl:text>if they can't even see the font?</xsl:text>
<xsl:text>I don't wanna hear your excuses!</xsl:text>
<xsl:text>The building has to be at least... three times bigger than this!</xsl:text>
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:comment>
</xsl:template>
</xsl:stylesheet>
當應用到這個SVG文件:
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 17.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="1024px" height="100px" viewBox="0 0 1024 100" enable-background="new 0 0 1024 100" xml:space="preserve">
<text transform="matrix(1 0 0 1 11.9 60.2537)" fill="#FFFFFF" font-family="'OpenSans'" font-size="35">Bigger Text</text>
<text transform="matrix(1 0 0 1 11.9 60.2537)" fill="#FFFFFF" font-family="'OpenSans'" font-size="20">Smaller Text</text>
</svg>
給出了這樣的:
<?xml version="1.0"?><!-- Generator: Adobe Illustrator 17.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --><svg version="1.1" id="Layer_1" x="0px" y="0px" width="1024px" height="100px" viewBox="0 0 1024 100" enable-background="new 0 0 1024 100" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<text transform="matrix(1 0 0 1 11.9 60.2537)" fill="#FFFFFF" font-family="'OpenSans'" font-size="35">Bigger Text</text>
<!--What is this?A font for ants?How can we be expected to teach children to learn how to read...if they can't even see the font?I don't wanna hear your excuses!The building has to be at least...three times bigger than this!-->
</svg>
有些背景在這裏很有用。顯而易見的答案:'@ font-size < 34'沒有它可能沒有意義。 –