-- 作者:pipif_l
-- 发布时间:5/19/2007 4:17:00 AM
-- [求助]固定长度输出
请帮我看看,我写了code但是为什么没有显示? 结果应该是: Simon is an engineer <!---------------------Try.xml------------> <?xml version="1.0" encoding="UTF-8"?> <?xml:stylesheet type="text/xsl" href="try.xsl" ?> <data> <Record> <Totals> <Row> <first_name>Simon</first_name> <Last_name></Last_name> <Salary>18,500</Salary> <Description>Simon is an engineer</Description> </Row> <Row> <first_name>Philip</first_name> <Last_name>Smith</Last_name> <Salary>500</Salary> <Description>Philip is an doctor</Description> </Row> </Totals> </Record> </data> <!--------------------try.xsl---------------------------> <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format"> <xsl:variable name="pos" select="position()" /> <xsl:template match="/data" name="getMessage"> <xsl:param name="Message1" select="/data/Record/Totals/Row[$pos]/Description" /> <xsl:param name="Link" select="''" /> <xsl:param name="MS" select="''"/> <xsl:for-each select="Record/Totals/Row[$pos]/Description"> <xsl:if test="string-length($Link) < 8"> <xsl:call-template name="getMessage"> <xsl:with-param name="MS" select="substring-before($Message1,'')" /> <xsl:with-param name="Message1" select="substring-after($Message1,'')" /> <xsl:with-param name="Link" select="concat($Link,$MS)" /> </xsl:call-template> </xsl:if> <xsl:value-of select="$Link" /> <xsl:if test="string-length($Link) > 8 or string-length($Link) = 8"> <xsl:value-of select="$Link" /> <xsl:text>
</xsl:text> </xsl:if> </xsl:for-each> </xsl:template> </xsl:stylesheet> [此贴子已经被作者于2007-5-20 5:54:40编辑过]
|