R
RE-DIK
Hallo zusammen,
ich verstehe meinen Fehler nicht. Ich hoffe hier kann mir jemand helfen.
Ich habe zwei XML Dateien und möchte die beiden zusammen fassen.
XML Datei
<root>
<person id="1" name="Dennis" note="1"/>
<person id="2" name="Albert" note="3"/>
<person id="2" name="Stephan" note="2"/>
</root>
XML Datei
<root>
<attribut id="1" attribut="sehr gut"/>
<attribut id="2" attribut="gut"/>
<attribut id="3" attribut="ausreichend"/>
</root>
XSL Datei
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl
utput method="xml" indent="yes" encoding="ISO-8859-1" omit-xml-declaration="yes" />
<xsl:template match="/">
<root>
<xsl:for-each select="root/person">
<tabelle>
<a>
<xsl:value-of select="@id"/>
</a>
<b>
<xsl:value-of select="@name"/>
</b>
<xsl:if test="document('Output.xml')/root/attribut/@id=document('datenbank.xml')/root/person/@note">
<c>
<xsl:value-of select="document('Output.xml')/root/attribut[@id=document('datenbank.xml')/root/person/@note]/@attribut"/>
</c>
</xsl:if>
</tabelle>
</xsl:for-each>
</root>
</xsl:template>
</xsl:stylesheet>
Output
<root>
<tabelle>
<a>1</a>
<b>Dennis</b>
<c>sehr gut</c>
</tabelle>
<tabelle>
<a>2</a>
<b>Albert</b>
<c>sehr gut</c>
</tabelle>
<tabelle>
<a>2</a>
<b>Stephan</b>
<c>sehr gut</c>
</tabelle>
</root>
Meine Frage wieso wieder holt er sich immer wieder mit "sehr gut" ?
vielen Dank im voraus
ich verstehe meinen Fehler nicht. Ich hoffe hier kann mir jemand helfen.
Ich habe zwei XML Dateien und möchte die beiden zusammen fassen.
XML Datei
<root>
<person id="1" name="Dennis" note="1"/>
<person id="2" name="Albert" note="3"/>
<person id="2" name="Stephan" note="2"/>
</root>
XML Datei
<root>
<attribut id="1" attribut="sehr gut"/>
<attribut id="2" attribut="gut"/>
<attribut id="3" attribut="ausreichend"/>
</root>
XSL Datei
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl

<xsl:template match="/">
<root>
<xsl:for-each select="root/person">
<tabelle>
<a>
<xsl:value-of select="@id"/>
</a>
<b>
<xsl:value-of select="@name"/>
</b>
<xsl:if test="document('Output.xml')/root/attribut/@id=document('datenbank.xml')/root/person/@note">
<c>
<xsl:value-of select="document('Output.xml')/root/attribut[@id=document('datenbank.xml')/root/person/@note]/@attribut"/>
</c>
</xsl:if>
</tabelle>
</xsl:for-each>
</root>
</xsl:template>
</xsl:stylesheet>
Output
<root>
<tabelle>
<a>1</a>
<b>Dennis</b>
<c>sehr gut</c>
</tabelle>
<tabelle>
<a>2</a>
<b>Albert</b>
<c>sehr gut</c>
</tabelle>
<tabelle>
<a>2</a>
<b>Stephan</b>
<c>sehr gut</c>
</tabelle>
</root>
Meine Frage wieso wieder holt er sich immer wieder mit "sehr gut" ?
vielen Dank im voraus