You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Erich Konicek <e....@nextra.at> on 2002/03/05 20:08:43 UTC
XML-tag in dom.text-node - how to do?
Hello all.
I'm new in programming with xml, xsl, xsl:fo and i have (not but) one
problem:
I'm generating a xml-file with dom-interface,
this file shoud bei transformed via xsl into a xsl:fo file.
I don't know, how to get xml-tags into the output-xml-file with dom.
For example a variable footer-text with a page-number-tag inside:
The fo-file shoud contain:
...
<fo:static-content flow-name="xsl-region-after">
<fo:block>
variable text from xml <fo:page-number/> variable text from xml
</fo:block>
</fo:static-content>
...
The xsl contains:
...
<xsl:template match="FOOTER">
<xsl:element name="fo:static-content">
<xsl:attribute name="flow-name">xsl-region-after</xsl:attribute>
<xsl:element name="fo:block">
<xsl:apply-templates/>
</xsl:element>
</xsl:element>
</xsl:template>
<xsl:template match="PAGE">
<fo:page-number/>
</xsl:template>
...
The xml shoud contain:
...
<FOOTER>
variable text bla bla <PAGE/> variable text
</FOOTER>
...
BUT it contains:
...
<FOOTER>
variable text bla bla <PAGE/> variable text
</FOOTER>
...
How can i get the <PAGE>-tag into a dom.text-node?
erich konicek
email: e.konicek@nextra.at
ieko - intelligente edv-konzepte
hinterhaus 4
A-3620 spitz / donau
Re: XML-tag in dom.text-node - how to do?
Posted by Jeremias Maerki <je...@outline.ch>.
This is not really the place to ask general XML/DOM questions but here's
what you're probably doing wrong: I presume you add the "<PAGE/>" as
part of a text node. That way some of the character get escaped like "<"
to <. To get around that you need to split up your text node into
different nodes. An example:
"variable text bla bla <PAGE/> variable text"
has to be expressed in a DOM as
text node: "variable text bla bla "
element node: "PAGE"
text node: " variable text"
That way, the special character don't get escaped. I hope this helps.
> I'm new in programming with xml, xsl, xsl:fo and i have (not but) one
> problem:
>
> I'm generating a xml-file with dom-interface,
> this file shoud bei transformed via xsl into a xsl:fo file.
>
> I don't know, how to get xml-tags into the output-xml-file with dom.
>
> For example a variable footer-text with a page-number-tag inside:
>
> The fo-file shoud contain:
> ...
> <fo:static-content flow-name="xsl-region-after">
> <fo:block>
> variable text from xml <fo:page-number/> variable text from xml
> </fo:block>
> </fo:static-content>
> ...
>
> The xsl contains:
> ...
> <xsl:template match="FOOTER">
> <xsl:element name="fo:static-content">
> <xsl:attribute name="flow-name">xsl-region-after</xsl:attribute>
> <xsl:element name="fo:block">
> <xsl:apply-templates/>
> </xsl:element>
> </xsl:element>
> </xsl:template>
>
> <xsl:template match="PAGE">
> <fo:page-number/>
> </xsl:template>
> ...
>
> The xml shoud contain:
> ...
> <FOOTER>
> variable text bla bla <PAGE/> variable text
> </FOOTER>
> ...
>
> BUT it contains:
> ...
> <FOOTER>
> variable text bla bla <PAGE/> variable text
> </FOOTER>
> ...
>
> How can i get the <PAGE>-tag into a dom.text-node?
Cheers,
Jeremias Märki
mailto:jeremias.maerki@outline.ch
OUTLINE AG
Postfach 3954 - Rhynauerstr. 15 - CH-6002 Luzern
Tel. +41 41 317 2020 - Fax +41 41 317 2029
Internet http://www.outline.ch