This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: copy-of / value-of
- From: Jan Theofel <theofel at etes dot de>
- To: xsl-list at lists dot mulberrytech dot com
- Date: Mon, 02 Sep 2002 16:43:04 +0200
- Subject: Re: [xsl] copy-of / value-of
- Organization: Espenhain & Theofel EDV-Systeme GbR
- References: <000e01c2528a$80bf9980$6401a8c0@pcukmka>
- Reply-to: xsl-list at lists dot mulberrytech dot com
Hello,
Michael Kay schrieb:
>
> > Program used: Saxon 5.6.2 (latest stable)
> I guess you mean 6.5.2...
Correct. Just a typo.
> > In my XML for that, I want to be able to add a tag <special> like:
> >
> > <special>
> > Some text here as line 1<br/>
> > Some text here as line 2
> > </special>
> >
> > But when I use this with value-of, the result is:
> >
> > Some text here as line 1 Some text here as line 2
> > (without the tag in the middle.)
> >
> > I also tried copy-of which is better, but copies also the XML tags.
> >
> > All I want to do is to be able to add a tag to my XML file
> > which may include HTML tags. How can I do this?
> >
>
> I don't understand: you seem to be making a distinction between "XML
> tags" and "HTML tags" in your XML file. How are they distinguished?
Well, my english is not so good, so I try again another explaination of my
problem:
I want to create three different HTML file using XML/XSLT. They have the same
content but very different layouts (one "normal", one for PDA and one for
printing). The XML file is a file programm.xml
(http://www.etes.de/files/programm.xml):
--- snip ---
<?xml version="1.0" encoding="ISO-8859-1"?>
<programm>
<zeitraum>September - Oktober 2002</zeitraum>
<veranstaltungen>
<termin>
<datum>Sa, 14.9.</datum>
<url>http://www.deutsches-museum.de/</url>
<titel>Besuch des Deutschen Museums in München</titel>
<starttext>ganztätig</starttext>
<zusatztext>
mit von Kepler-SeminaristInnen geleiteten Führungen in der Abteilung
Pharmazie<br/>
Teilnahme nur nach Rücksprache und Anmeldung
</zusatztext>
</termin>
<termin>
...
</termin>
...
</veranstaltungen>
</programm>
--- snap ---
You can see the <zusatztext> tag here (tag names are German - soory :-). It
contains a tag <br> which should appear in the final HTML code. The XSLT file
for conversion is for example programm-html.xsl.
(http://www.etes.de/files/programm-html.xsl; It produces a part of an HTML
file which is included in a bigger template.)
--- snip ---
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="ISO-8859-1" />
<xsl:template match="/">
<CENTER>
<P><FONT size="+2">Kepler-Seminar für Naturwissenschaften</FONT></P>
[...]
<xsl:for-each select="programm/veranstaltungen/termin">
[...]
<xsl:if test="zusatztext">
<xsl:value-of select="zusatztext" /><BR />
</xsl:if>
[...]
</xsl:for-each>
</CENTER>
</xsl:template>
</xsl:stylesheet>
--- snap ---
Here you can see the usage of thex "zusatztext".
The problem with the example above is that I get here for value-of as shown
above:
mit von Kepler-SeminaristInnen geleiteten Führungen in der Abteilung
Pharmazie
Teilnahme nur nach Rücksprache und Anmeldung
and not the wanted:
mit von Kepler-SeminaristInnen geleiteten Führungen in der Abteilung
Pharmazie<br>
Teilnahme nur nach Rücksprache und Anmeldung
> Can you give an example of the input and output of your transformation.
URLs:
http://www.etes.de/files/programm.xml
http://www.etes.de/files/programm-html.xsl
Perhaps a way to get a solution:
How would I have to write down special characters like < in the XML code
above?
Thanks,
Jan
--
Jan Theofel Fon: +49 (7 11) 48 90 83 - 0
ETES - EDV-Systemhaus GbR Fax: +49 (7 11) 48 90 83 - 50
Libanonstrasse 58 A * D-70184 Stuttgart Web: http://www.etes.de
______________________________________
Inflex - eMail Scanning and Protection
Queries to: postmaster@etes.de
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list