Indesign XML Tabelle via XSLT in XHTML umwandeln

Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

  • Indesign XML Tabelle via XSLT in XHTML umwandeln

    Folgendes Problem:

    Ich möchte von InDesign CS2 eine Tabelle mittels XML exportieren. Diese XML-Tabelle soll anschließend via XSLT in eine normale XHTML Tabelle umgewandelt werden. InDesign liefert mir folgendes XML:

    Quellcode

    1. <Table xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/" aid:table="table" aid:trows="8" aid:tcols="8">
    2. <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="60.11122047244095">1</Cell>
    3. <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="60.11122047244095">2</Cell>
    4. <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="60.11122047244095">3</Cell>
    5. <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="60.11122047244095">4</Cell>
    6. <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="60.11122047244095">5</Cell>
    7. <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="60.11122047244095">6</Cell>
    8. <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="60.11122047244095">7</Cell>
    9. <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="60.11122047244095">8</Cell>



    Mein XSLT sieht momentan wie folgt aus:

    Quellcode

    1. <xsl:template match="Table" aid:table="table">
    2. <table border="0" cellpadding="0" cellspacing="1" width="100%">
    3. <xsl:apply-templates/>
    4. </table>
    5. </xsl:template>
    6. <xsl:template match="Cell" aid:table="cell">
    7. <tr>
    8. <xsl:apply-templates/>
    9. </tr>
    10. </xsl:template>
    11. <xsl:template match="Cell">
    12. <xsl:element name="td">
    13. <xsl:attribute name="colspan"><xsl:value-of select="@aid:ccols"/></xsl:attribute>
    14. <xsl:attribute name="colwidth"><xsl:value-of select="@aid:ccolwidth"/></xsl:attribute>
    15. <xsl:apply-templates/>
    16. </xsl:element>
    17. </xsl:template>
    Alles anzeigen




    Scheinbar hab ich da etwas noch nicht ganz begriffen - da die Attribute jeweils nach der Transformation leer dastehen.
  • Die Rows gibt's so nicht...bis auf die Angabe aid:trows="8" im table-Element.


    Der Output sollte idealerweise etwa so außehen:

    Quellcode

    1. <table>
    2. <tr>
    3. <th>Berlin</th>
    4. <th>Hamburg</th>
    5. <th>M&uuml;nchen</th>
    6. </tr>
    7. <tr>
    8. <td>Milj&ouml;h</td>
    9. <td>Kiez</td>
    10. <td>Bierdampf</td>
    11. </tr>
    12. <tr>
    13. <td>Buletten</td>
    14. <td>Frikadellen</td>
    15. <td>Fleischpflanzerl</td>
    16. </tr>
    17. </table>
    Alles anzeigen
  • Versuch mal die beiden

    Quellcode

    1. <xsl:template match="Cell">

    zusammen zu fassen. Z.B. so:

    Quellcode

    1. <xsl:template match="Cell" aid:table="cell">
    2. <tr>
    3. <xsl:element name="td">
    4. <xsl:attribute name="colspan"><xsl:value-of select="@aid:ccols"/></xsl:attribute>
    5. <xsl:attribute name="colwidth"><xsl:value-of select="@aid:ccolwidth"/></xsl:attribute>
    6. <xsd:value-of select="."/>
    7. </xsl:element>
    8. </tr>
    9. </xsl:template>


    hth