Comment detail

与えられた文字列でピラミッド (Nested Flatten)
対象文字列はテンプレートパラメタ txt で渡してください。
 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
<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"
  >

  <xsl:param name="txt" as="xs:string" />

  <xsl:output method="text" />

  <xsl:template match="/" >
    <xsl:variable name="chars" as="xs:string*">
      <xsl:for-each select="fn:string-to-codepoints($txt)">
        <xsl:sequence select="fn:codepoints-to-string((.))" />
      </xsl:for-each>
    </xsl:variable>

    <xsl:for-each select="1 to fn:count($chars)">
      <xsl:variable name="wscount" as="xs:integer"
        select="fn:count($chars)-." />
      <xsl:for-each select="1 to $wscount" >
        <xsl:text> </xsl:text>
      </xsl:for-each>
      <xsl:value-of select="fn:subsequence($chars, $wscount+1)" />
      <xsl:text>&#xA;</xsl:text>
    </xsl:for-each>
  </xsl:template>

</xsl:stylesheet>

Index

Feed

Other

Link

Pathtraq

loading...