Hallo Ich habe ein XML-Dokument:
usw.......
Mein XSLT zu FO sieht so aus
Ich möchte nur die tags text und text:h angesprochen haben. Es wird mir aber der Wert aus person1 immer mit in das Ergebnis geschrieben.
Hier der Ausschnitt. Das Wort "dominik" habe ich durch keine Vorlage angesprochen. Es kommt aber trotzdem.
Ich habe oft Problem dieser Art. Irgendwie habe ich da einen Denkfehler.
Kann mir jemand helfen wie ich nur die Tags anspreche die ich auch haben möchte?
Danke
Dominik
PHP Code:
<?xml version="1.0" encoding="UTF-8"?>
<office:document-content xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
>
<person1>dominik</person1>
<text:h text:style-name="P7" text:outline-level="1">Das Abenteuer beginnt</text:h>
<text:p text:style-name="P15">Wie konnte es nur so weit kommen? Bin ich selbst schuld an
meinem Unglück? Und wenn, wie soll dies geschehen sein? Was soll ich jetzt machen? Ich
kann nirgends hingehen, es findet mich überall, egal wo ich bin und was ich auch</text:p>
Mein XSLT zu FO sieht so aus
PHP Code:
<?xml version="1.0" encoding="UTF-8"?>
<!--MasterTemplate afp-test 15.10.2008 -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0">
<xsl:output method="xml" version="1.0" indent="yes" encoding="UTF-8"/>
<!-- Seitenformat -->
<xsl:param name="seitenbreite">148mm</xsl:param>
<xsl:param name="seitenhoehe">210mm</xsl:param>
<!-- Seitenraender oben rechts unten links-->
<xsl:param name="raender_rechte_seite">0mm 15mm 8mm 15mm</xsl:param>
<xsl:param name="raender_linke_seite">0mm 15mm 8mm 15mm</xsl:param>
<xsl:param name="innenraender_rechte_seite">26mm 0mm 13mm 0mm</xsl:param>
<xsl:param name="innenraender_linke_seite">26mm 0mm 13mm 0mm</xsl:param>
<!-- Typografie -->
<xsl:param name="schriftname">serif</xsl:param>
<xsl:param name="schriftgroesse">10pt</xsl:param>
<xsl:param name="zeilenabstand">12pt</xsl:param>
<!-- Absatzformate -->
<xsl:attribute-set name="Grundschrift">
<xsl:attribute name="font-size">10pt</xsl:attribute>
<xsl:attribute name="line-height">12pt</xsl:attribute>
<xsl:attribute name="font-family">serif</xsl:attribute>
<xsl:attribute name="space-before">0mm</xsl:attribute>
<xsl:attribute name="space-after.minimum">1mm</xsl:attribute>
<xsl:attribute name="space-after">0mm</xsl:attribute>
<xsl:attribute name="space-after.maximum">3mm</xsl:attribute>
<xsl:attribute name="text-align">justify</xsl:attribute>
<xsl:attribute name="language">de</xsl:attribute>
<xsl:attribute name="hyphenate">true</xsl:attribute>
<xsl:attribute name="text-indent">5mm</xsl:attribute>
<xsl:attribute name="end-indent">0mm</xsl:attribute>
<xsl:attribute name="font-stretch">100%</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="Headline">
<xsl:attribute name="font-size">14pt</xsl:attribute>
<xsl:attribute name="line-height">11pt</xsl:attribute>
<xsl:attribute name="font-family">serif</xsl:attribute>
<xsl:attribute name="space-before">2mm</xsl:attribute>
<xsl:attribute name="space-after.minimum">1mm</xsl:attribute>
<xsl:attribute name="space-after">1mm</xsl:attribute>
<xsl:attribute name="space-after.maximum">3mm</xsl:attribute>
<xsl:attribute name="text-align">justify</xsl:attribute>
<xsl:attribute name="language">de</xsl:attribute>
<xsl:attribute name="hyphenate">true</xsl:attribute>
<xsl:attribute name="text-indent">0mm</xsl:attribute>
<xsl:attribute name="end-indent">0mm</xsl:attribute>
<xsl:attribute name="font-stretch">100%</xsl:attribute>
</xsl:attribute-set>
<!-- Templates -->
<xsl:template match="/">
<fo:root>
<fo:layout-master-set>
<fo:simple-page-master page-height="{$seitenhoehe}" page-width="{$seitenbreite}"
margin="{$raender_rechte_seite}" master-name="rechte-seite">
<fo:region-body margin="{$innenraender_rechte_seite}"/>
<fo:region-before region-name="kopf-rechte-seiten" extent="10mm"
display-align="before" background-color="white" precedence="false"/>
<fo:region-after region-name="fuss-rechte-seiten" extent="5mm"
display-align="before" background-color="white" precedence="false"/>
</fo:simple-page-master>
<fo:simple-page-master page-height="{$seitenhoehe}" page-width="{$seitenbreite}"
margin="{$raender_linke_seite}" master-name="linke-seite">
<fo:region-body margin="{$innenraender_linke_seite}" />
<fo:region-before region-name="kopf-linke-seiten" extent="10mm"
display-align="before" background-color="white"/>
<fo:region-after region-name="fuss-linke-seiten" extent="5mm"
display-align="before" background-color="white" precedence="false"/>
</fo:simple-page-master>
<fo:page-sequence-master master-name="inhalt-seiten">
<fo:repeatable-page-master-alternatives>
<fo:conditional-page-master-reference master-reference="rechte-seite"
odd-or-even="odd"/>
<fo:conditional-page-master-reference master-reference="linke-seite"
odd-or-even="even"/>
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="inhalt-seiten">
<fo:static-content flow-name="fuss-rechte-seiten">
<fo:block font-family="sans-serif" font-size="8pt" text-align-last="justify">
<fo:leader/><fo:page-number/></fo:block>
</fo:static-content>
<fo:static-content flow-name="fuss-linke-seiten">
<fo:block font-family="sans-serif" font-size="8pt" text-align-last="justify">
<fo:leader/><fo:page-number/></fo:block>
</fo:static-content>
<fo:static-content flow-name="kopf-rechte-seiten">
</fo:static-content>
<fo:static-content flow-name="kopf-linke-seiten">
</fo:static-content>
<fo:flow flow-name="xsl-region-body">
<xsl:call-template name="starter"/>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
<!-- Stylesheets für die Tags -->
<xsl:template name="starter">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="text:h">
<fo:block xsl:use-attribute-sets="Headline">
<xsl:value-of select="text:h"/>
<xsl:apply-templates/>
</fo:block>
</xsl:template>
<xsl:template match="text:p">
<fo:block xsl:use-attribute-sets="Grundschrift">
<xsl:value-of select="text:p"/>
<xsl:apply-templates/>
</fo:block>
</xsl:template>
</xsl:stylesheet>
Hier der Ausschnitt. Das Wort "dominik" habe ich durch keine Vorlage angesprochen. Es kommt aber trotzdem.
PHP Code:
<fo:block font-family="sans-serif" font-size="8pt" text-align-last="justify">
<fo:leader/>
<fo:page-number/>
</fo:block>
</fo:static-content>
<fo:static-content flow-name="fuss-linke-seiten">
<fo:block font-family="sans-serif" font-size="8pt" text-align-last="justify">
<fo:leader/>
<fo:page-number/>
</fo:block>
</fo:static-content>
<fo:static-content flow-name="kopf-rechte-seiten"/>
<fo:static-content flow-name="kopf-linke-seiten"/>
<fo:flow flow-name="xsl-region-body">
dominik
<fo:block font-size="14pt" line-height="11pt" font-family="serif" space-before="2mm"
space-after.minimum="1mm"
space-after="1mm"
space-after.maximum="3mm"
text-align="justify"
language="de"
hyphenate="true"
text-indent="0mm"
end-indent="0mm"
font-stretch="100%">Das Abenteuer beginnt</fo:block>
<fo:block font-size="10pt" line-height="12pt" font-family="serif" space-before="0mm"
space-after.minimum="1mm"
Ich habe oft Problem dieser Art. Irgendwie habe ich da einen Denkfehler.
Kann mir jemand helfen wie ich nur die Tags anspreche die ich auch haben möchte?
Danke
Dominik
Comment