Hallo zusammen,
habe mich hier registriert, da meine XSL-Kenntnisse etwas eingerostet sind und ich nicht weiterkomme.
Ich möchte um eine Auswahl von Knoten ein umschließenden Parent-Knoten herumbauen. Das Problem an der Sache ist, dass ich eine Tabellenstruktur habe und der Head-bereich nicht mitausgewählt werden soll. Die Selektion des zukünftigen Bodys bekomme ich mit folgendem Befehl hin:
Das Ausgangsdokument hat folgende Struktur:
Die gewünschte Struktur soll eine HTML-Struktur sein, die bekomme ich auch bis auf das <tbody>-Element auch hin:
Mein XSL-Template sieht wie folgt aus:
Kann mir hier einer weiterhelfen, bzw. hat einer eine Idee das <tbody> um die rows zu bauen?
Danke und viele Grüße
Michael
habe mich hier registriert, da meine XSL-Kenntnisse etwas eingerostet sind und ich nicht weiterkomme.
Ich möchte um eine Auswahl von Knoten ein umschließenden Parent-Knoten herumbauen. Das Problem an der Sache ist, dass ich eine Tabellenstruktur habe und der Head-bereich nicht mitausgewählt werden soll. Die Selektion des zukünftigen Bodys bekomme ich mit folgendem Befehl hin:
Code:
<xsl:template match="/tupleSource/row[preceding-sibling::columns]">
Code:
<tupleSource> <columns> <column index="1">Dies ist die Kopfzeile</column> ... </columns> <row> <value columnsIndex="1!>Text der 1. Spalte in Zeile 1</column> ... </row> <row> <value columnsIndex="1!>Text der 1. Spalte in Zeile 2</column> ... </row> </tupleSource>
Code:
<table> <thead> <tr> <th><p>Dies ist die Kopfzeile</p></th> ... </tr> </thead> <!-- Hier soll tbody rein --> <row> <th><p>Text der 1. Spalte in Zeile 1</p></th> ... <row> <row> <th><p>Text der 1. Spalte in Zeile 2</p></th> ... </row> <!-- Hier soll Ende tbody rein --> </table>
Code:
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs" version="3.0"> <xsl:output method="xml" encoding="UTF-8"/> <xsl:template match="/"> <stimport> <xsl:apply-templates/> </stimport> </xsl:template> <xsl:template match="/tupleSource"> <node> <xsl:attribute name="id">f1u6</xsl:attribute> <xsl:attribute name="parent">1005190155</xsl:attribute> <xsl:attribute name="class" >/class::BaseNodeClass/DocuManagerBaseClass/TextNode/InformationType/InfoType10</xsl:attribute> <attribute name="Title" type="string" aspect="de">Fundamentausgabe_Test</attribute> <attribute> <xsl:attribute name="name">Content</xsl:attribute> <xsl:attribute name="type">xml-w-images</xsl:attribute> <xsl:attribute name="aspect">de</xsl:attribute> <content> <table-container type="header"> <table> <xsl:apply-templates/> </table> </table-container> </content> </attribute> </node> </xsl:template> <xsl:template match="/tupleSource/row"> <tr> <xsl:apply-templates/> </tr> </xsl:template> <xsl:template match="/tupleSource/columns"> <thead> <tr> <xsl:apply-templates/> </tr> </thead> </xsl:template> <xsl:template match="/tupleSource/columns/column[@name]"> <th> <p type="p_table_l"> <xsl:value-of select="@name"/> </p> </th> </xsl:template> <xsl:template match="/tupleSource/row/value"> <td> <p type="p_table_l"> <xsl:apply-templates/> </p> </td> </xsl:template> <!-- Hier fängt das Problem an und das Programm (Oxygen XML-Editor hängt sich auf <xsl:template match="/tupleSource/row[preceding-sibling::columns]"> <tbody> <xsl:copy-of select="node()"/> <xsl:apply-templates/> </tbody> </xsl:template> --> </xsl:stylesheet>
Danke und viele Grüße
Michael
Comment