This is a question for a general XSL list like the Mulberry list. For more
information see:
http://www.mulberrytech.com/xsl/index.html
A couple of hints:
1. _Never_ use xsl:text with disable-output-escaping to generate
elements in the result tree. Use xsl:element, or literal result
elements instead.
2. Consider multiple templates with specific match patterns.
Examples:
<xsl:template match="attribute[@name='objectname']">
<Kurztitel><xsl:value-of select="."/></Kurztitel>
</xsl:template>
<xsl:template match="attribute[@name='thema']">
<xsl:element name="Thema"><xsl:value-of select="."/></xsl:element>
</xsl:template>
Dave
Carsten Heyl
<cal@pixelbox To: [EMAIL PROTECTED]
x.de> cc: (bcc: David N
Bertoni/CAM/Lotus)
Sent by: Subject: XSL Beginners
question
[EMAIL PROTECTED]
07/12/2001
11:09 AM
Please
respond to
xalan-dev
Hi XSL-Experts!
I'm having a very simple structured part of a bigger XML Document:
<tag1>
<pbobjects>
<pbobject>
<attributes>
<attribute name="version">JFIF 1.02</attribute>
<attribute name="id">36200</attribute>
<attribute name="bylinetitle"></attribute>
<attribute name="specialinstructions"></attribute>
<attribute name="comment"></attribute>
<attribute name="credit"></attribute>
<attribute name="byline"></attribute>
...
<attribute name="application">Photoshop 3.0</attribute>
<attribute name="keywords"></attribute>
<attribute name="mode"></attribute>
<attribute name="unit">1</attribute>
... about 100 attributes
</attributes>
</pbobject>
<pbobject>
<attributes>
...
</attributes>
</pbobject>
...
</pbobjects>
</tag1>
Now I want to print out and convert only a few of that attributes (using
special formatting for some)
and came to the following:
<xsl:template match="attribute">
<xsl:choose>
<xsl:when test="@name='objectname'">
<xsl:text disable-output-escaping="yes"> <Kurztitel>
</xsl:text><xsl:value-of select="."/><xsl:text>
</xsl:text>
</xsl:when>
<xsl:when test="@name='thema'">
<xsl:text disable-output-escaping="yes"> <Thema>
</xsl:text><xsl:value-of select="."/><xsl:text>
</xsl:text>
</xsl:when>
<xsl:when test="@name='supplementalcategory'">
<xsl:text disable-output-escaping="yes"> <ThemaBildnachw>
</xsl:text><xsl:value-of select="."/><xsl:text>
</xsl:text>
</xsl:when>
... (for all attributes I want)
</xsl:choose>
</xsl:template>
I guess there is a much simpler and faster alternative than that.
Can anyone help?
Thanks in advance!
Carsten Heyl
--
Carsten Heyl [EMAIL PROTECTED]
Pixelboxx GmbH http://www.pixelboxx.de/
Ostenhellweg 56-58 Tel.: +49 231 53 46 30
D-44135 Dortmund Mobile: +49 174 31 83 608