Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
converting_to_header.xslt29 linesDownload Raw Back to xsl
1<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">2  <!-- Copy all nodes and attributes by default -->3  <xsl:template match="@*|node()">4    <xsl:copy>5      <xsl:apply-templates select="@*|node()"/>6    </xsl:copy>7  </xsl:template>8 9  <!-- Match any element that has a font-size attribute larger than 20px -->10  <xsl:template match="*[@style[contains(., 'font-size')]]">11    <!-- Extract the font size value from the style attribute -->12    <xsl:variable name="font-size" select="substring-before(substring-after(@style, 'font-size:'), 'px')" />13    <!-- Check if the font size is larger than 20 -->14    <xsl:choose>15      <xsl:when test="$font-size > 20">16        <!-- Replace the element with a header tag -->17        <h1>18          <xsl:apply-templates select="@*|node()"/>19        </h1>20      </xsl:when>21      <xsl:otherwise>22        <!-- Keep the original element -->23        <xsl:copy>24          <xsl:apply-templates select="@*|node()"/>25        </xsl:copy>26      </xsl:otherwise>27    </xsl:choose>28  </xsl:template>29</xsl:stylesheet>
codekingpro/portable-devtools · Team Ai