我创建了一个xsl文件,它将输出两个XML:s。从外部XML文件输出
其中一个xml应该只被收割一次。因为它只有一个结构和它的工作,所以我不会发布代码, 但在另一个我想输出整个树结构。但它的唯一打印第一个。而不是整棵树。
这病想出此刻
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<xsl:for-each select="$doc1//quiz//question">
<xsl:value-of select="$doc1//author" />
<br />
<xsl:value-of select="$doc1//questionText" />
<br />
<xsl:text>Ger </xsl:text><xsl:value-of select="$doc1//points" /><xsl:text> Poäng </xsl:text>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
感谢
编辑: 威尔广告我的XML文件
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="q2.xsl"?>
<quiz>
<question>
<author>Författare 1</author>
<questionText>Fråga 1</questionText>
<correct>Svar 1</correct>
<incorrect>fel 1</incorrect>
<incorrect>fel 1-2</incorrect>
<points>1</points>
</question>
<question>
<author>Författare 2</author>
<questionText>Fråga 2</questionText>
<correct>Svar 2</correct>
<incorrect>fel 2</incorrect>
<incorrect>fel 2-3</incorrect>
<points>2</points>
</question>
<question>
<author>Författare 3</author>
<questionText>Fråga 3</questionText>
<correct>Svar 3</correct>
<incorrect>fel 3</incorrect>
<incorrect>fel 3-4</incorrect>
<points>3</points>
</question>
<question>
<author>Författare 4</author>
<questionText>Fråga 4</questionText>
<correct>Svar 4</correct>
<incorrect>fel 4</incorrect>
<incorrect>fel 4-5</incorrect>
<points>4</points>
</question>
<question>
<author>Författare 5</author>+
<questionText>Fråga 5</questionText>
<correct>Svar 5</correct>
<incorrect>fel 5</incorrect>
<incorrect>fel 5-6</incorrect>
<points>5</points>
</question>
</quiz>
你可以添加你的xml,那么它可能更容易提供一个解决方案。 – Treemonkey 2012-01-13 11:36:03