turugina #6634(2008/07/01 04:09 GMT) [ XSLT ] Rating0/0=0.00
indexが1始まりだと混乱する...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:my="uri:ja.doukaku.org:my-functions" exclude-result-prefixes="my" > <xsl:output method="text" /> <xsl:variable name="convert_table" as="xs:string+"> <xsl:for-each select="1 to 26"> <xsl:sequence select="fn:codepoints-to-string( (fn:string-to-codepoints('A')[1] + . - 1) )" /> </xsl:for-each> </xsl:variable> <xsl:variable name="table_size" as="xs:integer" select="fn:count($convert_table)" /> <xsl:template match="/" > <xsl:variable name="seq" as="xs:string*"> <xsl:for-each select="1 to 100"> <xsl:sequence select="my:alphabeticalize(.)" /> </xsl:for-each> </xsl:variable> <xsl:value-of select="fn:string-join($seq, ', ')" /> <xsl:text>
</xsl:text> </xsl:template> <xsl:function name="my:alphabeticalize" as="xs:string"> <xsl:param name="n" as="xs:integer" /> <xsl:variable name="i" as="xs:integer" select="$n - 1" /> <xsl:variable name="n_" as="xs:string" select="$convert_table[($i mod $table_size) + 1]" /> <xsl:choose> <xsl:when test="$i idiv $table_size = 0"> <xsl:value-of select="$n_" /> </xsl:when> <xsl:otherwise> <xsl:value-of select="fn:concat( my:alphabeticalize($i idiv $table_size), $n_)" /> </xsl:otherwise> </xsl:choose> </xsl:function> </xsl:stylesheet>
Rating0/0=0.00-0+
[ reply ]
turugina
#6634()
[
XSLT
]
Rating0/0=0.00
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:my="uri:ja.doukaku.org:my-functions" exclude-result-prefixes="my" > <xsl:output method="text" /> <xsl:variable name="convert_table" as="xs:string+"> <xsl:for-each select="1 to 26"> <xsl:sequence select="fn:codepoints-to-string( (fn:string-to-codepoints('A')[1] + . - 1) )" /> </xsl:for-each> </xsl:variable> <xsl:variable name="table_size" as="xs:integer" select="fn:count($convert_table)" /> <xsl:template match="/" > <xsl:variable name="seq" as="xs:string*"> <xsl:for-each select="1 to 100"> <xsl:sequence select="my:alphabeticalize(.)" /> </xsl:for-each> </xsl:variable> <xsl:value-of select="fn:string-join($seq, ', ')" /> <xsl:text>
</xsl:text> </xsl:template> <xsl:function name="my:alphabeticalize" as="xs:string"> <xsl:param name="n" as="xs:integer" /> <xsl:variable name="i" as="xs:integer" select="$n - 1" /> <xsl:variable name="n_" as="xs:string" select="$convert_table[($i mod $table_size) + 1]" /> <xsl:choose> <xsl:when test="$i idiv $table_size = 0"> <xsl:value-of select="$n_" /> </xsl:when> <xsl:otherwise> <xsl:value-of select="fn:concat( my:alphabeticalize($i idiv $table_size), $n_)" /> </xsl:otherwise> </xsl:choose> </xsl:function> </xsl:stylesheet>Rating0/0=0.00-0+
[ reply ]