|
以文本方式查看主题 - 计算机科学论坛 (http://bbs.xml.org.cn/index.asp) -- 『 XSL/XSLT/XSL-FO/CSS 』 (http://bbs.xml.org.cn/list.asp?boardid=8) ---- 另一个xsl转换问题,给位帮忙解决 (http://bbs.xml.org.cn/dispbbs.asp?boardid=8&rootid=&id=9869) |
|
-- 作者:菜籽 -- 发布时间:9/9/2004 2:23:00 PM -- 另一个xsl转换问题,给位帮忙解决 有一个xml文件如下: <?xml version="1.0" encoding="GBK"?> <?xml-stylesheet type="text/xsl" href="4.xml"?> <Question ID="0" ZTMXH="0" KMDM="CCSJ0" TMLX="XZ0"> <QuestionPart XH="1"> <TextBlock>题干文本</TextBlock> <MediaBlock>题干媒体</MediaBlock> </QuestionPart> <AnswerPart XH="2" B_ZQDA="false" B_YC="false"> <TextBlock>答案1文本 1</TextBlock> <MediaBlock>答案1媒体1</MediaBlock> <TextBlock>答案1文本 2</TextBlock> <MediaBlock>答案1媒体2</MediaBlock> </AnswerPart> </AnswerPart> |
|
-- 作者:sam -- 发布时间:9/9/2004 7:14:00 PM -- <?xml version="1.0" encoding="gb2312"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <xsl:for-each select="//QuestionPart"> <xsl:variable name="qp" select="position()"></xsl:variable> <xsl:for-each select="TextBlock | MediaBlock"> <xsl:variable name="tmp">tg<xsl:value-of select="$qp"/><xsl:value-of select="position()"/> </xsl:variable> <xsl:variable name="tmpv" select="."/> <input name="{$tmp}" value="{$tmpv}"/> </xsl:for-each> </xsl:for-each> <xsl:for-each select="//AnswerPart"> <xsl:variable name="ap" select="position()"></xsl:variable> <xsl:for-each select="TextBlock | MediaBlock"> <xsl:variable name="tmp">da<xsl:value-of select="$ap"/>_<xsl:value-of select="position()"/> </xsl:variable> <xsl:variable name="tmpv" select="."/> <input name="{$tmp}" value="{$tmpv}"/> </xsl:for-each> </xsl:for-each> </xsl:template> </xsl:stylesheet> |
|
-- 作者:菜籽 -- 发布时间:9/9/2004 9:54:00 PM -- 谢谢sam,真的十分感谢! |
|
W 3 C h i n a ( since 2003 ) 旗 下 站 点 苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》 |
56.641ms |