Hallo,
ich wollte mal anfragen, ob jemand von euch mir einen tipp geben koennte. [...] Anbei ein beispiel, an dem ich langsam verzweifle. der obere teil stellt die xml quelle dar und der untere teil, wo ich hinkommen möchte. Allein mit apply-template scheine ich da nicht weiter zu kommen.
<nparag>this is a <ref> element</ref> text: <seqlist>
[...]
</seqlist>
</nparag>
<!-- should be converted to -->
text:pthis is a <refnew> element</refnew> text: </text:p>
text:list
</text:list>
Sowas machen zu wollen ist ziemlich schlechter Stil / unüberlegter Dokumentdesing. Dementsprechend kannst du nur auf die übelste Art hacken (mit xsl:text), damit das geht:
Grüße
Thomas
--------------------
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:text="http://example.org/text">
<xsl:strip-space elements="*"/>
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
xsl:apply-templates/
</xsl:template>
<xsl:template match="nparag">
xsl:apply-templates/
</xsl:template>
<xsl:template match="nparag/text()">
<xsl:if test="not(preceding-sibling::text())">
<xsl:text disable-output-escaping="yes"><text:p></xsl:text>
</xsl:if>
xsl:copy
xsl:apply-templates/
</xsl:copy>
<xsl:if test="not(following-sibling::text())">
<xsl:text disable-output-escaping="yes"></text:p></xsl:text>
</xsl:if>
</xsl:template>
<xsl:template match="ref">
<newref>
xsl:apply-templates/
</newref>
</xsl:template>
<xsl:template match="seqlist">
text:list
xsl:apply-templates/
</text:list>
</xsl:template>
<xsl:template match="item">
text:list-item
xsl:apply-templates/
</text:list-item>
</xsl:template>
<xsl:template match="para">
text:p
xsl:apply-templates/
</text:p>
</xsl:template>
<xsl:template match="standard">
<otherstandard>
xsl:apply-templates/
</otherstandard>
</xsl:template>
</xsl:stylesheet>