Hallo zusammen,
ich bin noch Newbie und beisse mir gerade an der folgenden Aufgabenstellung die Zähne aus.
XML:
Nun möchte ich eine Tabelle ausgeben mit der folgenden Struktur:
fb1->id attr1 fb1->attr2 fb1->attr3
__ fbaction->attr1 fbaction1->attr2
__ fbaction->attr1 fbaction1->attr2
-->bis hier kein Problem
__bk-->id (where fbevent->id = fb1->id) fbevent->action
fb2->id attr1 fb2->attr2 fb2->attr3
__ fbaction->attr1 fbaction->attr2
__ fbaction->attr1 fbaction->attr2
__ bk-->id (where fbevent->id = fb2->id) fbevent->action
Die letzte Information bk->id bekomme ich einfach nicht in die Tabelle.
Hier mein bisher verwendetes XSL:
Kann mir hier bitte jemand einen Tip geben, wie ich diese fehlende Information ausgeben kann?
Herzlichen Dank im voraus,
Dirk
ich bin noch Newbie und beisse mir gerade an der folgenden Aufgabenstellung die Zähne aus.
XML:
Code:
<fblist> <fb id="sb_gl2_a" unit="1" pin="3" x="5" y="1" z="1" state="false" prev_id="sb_gl2_a" desc="sb_gl2_a" show="true" ori="west" iid="" bus="0" action="false" addr="3"/> <fb id="sb_gl1_a" unit="1" pin="1" x="5" y="0" z="1" state="false" prev_id="sb_gl1_a" desc="sb_gl1_a" show="true" ori="west" iid="" bus="0" action="false" addr="1"/> <fb id="BW_gl1_m" x="16" y="13" z="1" state="false" prev_id="BW_gl1_m" desc="BW_gl1_m" show="true" ori="west" iid="" bus="0" addr="0" action="true" road="false" blockid="" activelow="false"> <fbaction type="sw" id="SB_gl4_o" cmd="turnout" activate="true"/> <fbaction type="sw" id="SB_gl4_w" cmd="straight" activate="true"/> </fb> </fblist> <bklist> <bk id="SB_gl3" x="12" y="2" z="1" state="open" prev_id="SB_gl3" desc="" len="0" electrified="false" station="false" wait="false" gomanual="true" acceptghost="false" terminalstation="false" commuter="no" fba="" fbb="" fbi="" fbr="" fbm="" signal="" wsignal="" speed="cruise" type="none" incline="0" waitmode="random" minwaittime="1" maxwaittime="30" waittime="10" evttimer="0" iid="" addr="0" port="0" td="false" locid="BR55" signalR="" wsignalR="" exitspeed="cruise" ttid=""> <fbevent id="sb_gl3_m" action="enter" from="w_gl2" endpuls="false"/> <fbevent id="sb_gl3_b" action="in" from="w_gl2" endpuls="false"/> <fbevent id="w_gl2_m" action="enter" from="SB_gl2" endpuls="false"/> <fbevent id="sb_gl3_m" action="enter" from="o_gl2" endpuls="false"/> <fbevent id="sb_gl3_a" action="in" from="o_gl2" endpuls="false"/> </bk> <bklist>
fb1->id attr1 fb1->attr2 fb1->attr3
__ fbaction->attr1 fbaction1->attr2
__ fbaction->attr1 fbaction1->attr2
-->bis hier kein Problem
__bk-->id (where fbevent->id = fb1->id) fbevent->action
fb2->id attr1 fb2->attr2 fb2->attr3
__ fbaction->attr1 fbaction->attr2
__ fbaction->attr1 fbaction->attr2
__ bk-->id (where fbevent->id = fb2->id) fbevent->action
Die letzte Information bk->id bekomme ich einfach nicht in die Tabelle.
Hier mein bisher verwendetes XSL:
Code:
<?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" encoding="UTF-8"/> <xsl:template match="/"> <html> <head><title>Feedback</title> </head> <body> <h2>Feedback report</h2> <table border="1" rules="all" cellpadding="4" cellspacing="0" width="80%"> <THEAD> <TR> <TH width="20%" height="30" bgcolor="lightgrey">ID</TH> <TH width="40%" bgcolor="lightgrey">Description</TH> <TH width="20%" bgcolor="lightgrey">IID</TH> <TH width="20%" bgcolor="lightgrey">Address</TH> </TR> </THEAD> <TBODY> <xsl:apply-templates/> </TBODY> </table> </body> </html> </xsl:template> <xsl:template match="fblist"> <xsl:apply-templates> <xsl:sort select="@addr" order="ascending" data-type="number" /> </xsl:apply-templates> </xsl:template> <xsl:template match="fb"> <TR> <TD><xsl:value-of select="@id" /></TD> <xsl:variable name="desc1" select="@desc" /> <TD> <xsl:choose> <xsl:when test="$desc1 = ''"> <xsl:text>-</xsl:text> </xsl:when> <xsl:otherwise> <xsl:value-of select="@desc" /> </xsl:otherwise> </xsl:choose> </TD> <xsl:variable name="iid1" select="@iid" /> <TD align="center"> <xsl:choose> <xsl:when test="$iid1 = ''"> <xsl:text>-</xsl:text> </xsl:when> <xsl:otherwise> <xsl:value-of select="@iid" /> </xsl:otherwise> </xsl:choose> </TD> <TD align="center"><xsl:value-of select="@addr" /></TD> </TR> <xsl:apply-templates/> </xsl:template> <xsl:template match="fbaction"> <TR> <TD></TD> <TD colspan="3"> <table border="0" rules="all" cellpadding="4" cellspacing="0" width="100%"> <tr> <td><b>Action</b></td> <td><xsl:value-of select="@type" />-><xsl:value-of select="@id" />-><xsl:value-of select="@cmd" /></td> </tr> </table> </TD> </TR> <xsl:apply-templates/> </xsl:template> </xsl:stylesheet>
Herzlichen Dank im voraus,
Dirk
Comment