This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: copy-of / value-of
- From: "Michael Kay" <michael dot h dot kay at ntlworld dot com>
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Mon, 2 Sep 2002 18:25:14 +0100
- Subject: RE: [xsl] copy-of / value-of
- Reply-to: xsl-list at lists dot mulberrytech dot com
I think you want:
<xsl:if test="zusatztext">
<xsl:copy-of select="zusatztext/child::node()" /><BR />
</xsl:if>
which will copy the <br/> element to the HTML output
Michael Kay
Software AG
home: Michael.H.Kay@ntlworld.com
work: Michael.Kay@softwareag.com
> -----Original Message-----
> From: owner-xsl-list@lists.mulberrytech.com
> [mailto:owner-xsl-list@lists.mulberrytech.com] On Behalf Of
> Jan Theofel
> Sent: 02 September 2002 15:43
> To: xsl-list@lists.mulberrytech.com
> Subject: Re: [xsl] copy-of / value-of
>
>
>
> 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
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list