Hallo!
Ich habe ein XML Dokument, welches Elemente enthält, die einerseits als Block Elemente aber auch als Inline Elemente auftreten können. Diese Elemente möchte ich bei der XSLT Transformation unterschiedlich behandeln. Wie selektiere ich das Element, wenn es als Inline Element auftritt?
Beispiel für das Ausgangsdokument:
So soll das Ergebnisdokument aussehen:
Mein XSLT:
Nochmal gefragt, wie selektiere ich das mediaobject Element wenn es innerhalb des para auftaucht UND von Text umgeben ist? Blöderweise ist das mediaboject als Block ebenfalls Kind-Element eines para, ich kann es deshalb nicht einfach per select="para/mediaobject" auswählen.
Danke für eure Hilfe, nE
Ich habe ein XML Dokument, welches Elemente enthält, die einerseits als Block Elemente aber auch als Inline Elemente auftreten können. Diese Elemente möchte ich bei der XSLT Transformation unterschiedlich behandeln. Wie selektiere ich das Element, wenn es als Inline Element auftritt?
Beispiel für das Ausgangsdokument:
Code:
<para>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.</para> <!-- hier ist mediaobject ein Block-Element--> <para> <mediaobject> <imageobject> <imagedata fileref="./images/block.png" width="100%"/> </imageobject> <caption> <para>Block Image</para> </caption> </mediaobject> </para> <!-- hier ist mediaobject ein Inline-Element--> <para> Lorem ipsum (<mediaobject> <imageobject> <imagedata fileref="./images/icon.png" width="100%"/> </imageobject> </mediaobject>) dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. </para>
Code:
<para>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.</para> <figure> <title>some title</title> <mediaobject> <imageobject> <imagedata width="100%" fileref="./images/block.png"/> </imageobject> </mediaobject> </figure> <para>Lorem ipsum (<inlinemediaobject><imageobject><imagedata fileref="./images/icon.png" align="left" contentdepth="1em"/></imageobject></inlinemediaobject>) dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.</para>
Code:
<!-- mediaobject ist Block Element --> <xsl:template match="mediaobject"> .... transformation in figure .... </xsl:template> <!-- mediaobject ist Inline Element --> <xsl:template match="????"> .... transformation in inlinemediaobject .... </xsl:template>
Danke für eure Hilfe, nE
Comment