作者热门文章
- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我想要这个:
使用 XSLT,将字母表中的每个字母放入其自己的网格单元格中。最终结果将是 (result.xaml):
XAML 网格:1 列,26 行。字母表中的每个字母一行。
也许有一种 ASCII 码方法可以做到这一点?我不确定。
谢谢
最佳答案
以下样式表中的递归模板 printAlphabetRows
从 1 迭代到 26,并使用带有格式选项的 xsl:number
在每次迭代中打印相应的字母。
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<Grid xmlns="http://schemas.microsoft.com/winfx/avalon/2005" Width="400" Height="200"
Background="LightBlue">
<ColumnDefinition/>
<RowDefinition Height="Auto"/>
<xsl:call-template name="printAlphabetRows"/>
</Grid>
</xsl:template>
<xsl:template name="printAlphabetRows">
<xsl:param name="letter" select="1"/>
<TextBlock Grid.Column="0" Grid.Row="0">
<xsl:number value="$letter" format="a"/>
</TextBlock>
<xsl:if test="$letter < 26">
<xsl:call-template name="printAlphabetRows">
<xsl:with-param name="letter" select="$letter+1"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
注意:我对 XAML 网格一无所知,因此 XML 结构可能略有偏差(我在 google 上搜索了 XAML 网格的示例),但应该足以了解如何使用模板。
关于silverlight - Xsl & Silverlight : Using XSLT and an algorithm, 如何打印出整个拉丁字母 (a,b,c..z)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6975534/
我想将 Casa_Batll%C3%B3 转换为 Casa_Batllş。 NSLog(@"Converting String:%@",[@"Casa_Batll%C3%B3" stringByRep
使用 clang++ 3.2。尝试打印 𝖆 (\u1D586), cout << endl; 或者, cout << "\u1D586" << endl; 得到不完整的输出: ᵘ6 似乎最后一个
你能轻松地在 ASCII 字符和它们的亚洲全角 Unicode 宽字符之间转换吗?喜欢: 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRS
我是一名优秀的程序员,十分优秀!