-
-
Save designermonkey/4546633 to your computer and use it in GitHub Desktop.
Revisions
-
designermonkey revised this gist
Jan 16, 2013 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -13,7 +13,7 @@ <xsl:param name="value" select="0.8"/> <xsl:param name="list"/> <xsl:for-each select="$list/item"> <xsl:sort select="(. - $value) * not(0 > . - $value ) - (. - $value) * (0 > . - $value)"/> <xsl:if test="position() = 1"> <xsl:value-of select="@name"/> @@ -22,4 +22,4 @@ </xsl:template> </xsl:stylesheet> -
There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ <data> <aspectratios> <item name="onebyone">1</item> <item name="onebytwo">0.5</item> <item name="onebythree">0.33333</item> <item name="twobyone">2</item> <item name="twobythree">0.66667</item> <item name="twobyfive">0.4</item> <item name="threebyone">3</item> <item name="threebytwo">1.5</item> <item name="threebyfive">0.6</item> <item name="fivebytwo">2.5</item> <item name="fivebythree">1.66667</item> </aspectratios> </data> 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="xml" indent="yes" /> <xsl:template match="/"> <xsl:call-template name="find-nearest-value"> <xsl:with-param name="list" select="aspectratios"/> </xsl:call-template> </xsl:template> <xsl:template name="find-nearest-value"> <xsl:param name="value" select="0.8"/> <xsl:param name="list"/> <xsl:for-each select="list/item"> <xsl:sort select="(. - $value) * not(0 > . - $value ) - (. - $value) * (0 > . - $value)"/> <xsl:if test="position() = 1"> <xsl:value-of select="@name"/> </xsl:if> </xsl:for-each> </xsl:template> </xsl:stylesheet>