This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: xsl:if and xsl:when
- To: "'xsl-list at mulberrytech dot com'" <xsl-list at mulberrytech dot com>
- Subject: RE: xsl:if and xsl:when
- From: "Medina, Edward" <emedina at btg dot com>
- Date: Thu, 30 Mar 2000 09:36:21 -0500
- Reply-To: xsl-list at mulberrytech dot com
Thanks Dave!
I realize that the // will match any illust with obj.id attribute with value
1.
The problem is that I only have one illust element which has the obj.id
attribute
at all. So is it not recognizing the attribute? Is my syntax wrong?
Just this morning came accross another type of format from the article by
Didier Martin Style Matters
http://www.xml.com/pub/2000/02/16/style/index.html
He has the following example
<xsl:choose>
<xsl:when test="contains(@xlink:show,'embed')">
<xsl:choose>
<xsl:when test="contains(@xstyle:type,'image/svg')">
<embed type="image/svg">
(Whole bunch of code ommited)
</xsl:when>
<xsl:when test="contains(@xstyle:type,'text/xhtm')">
<xsl:apply-templates
select="document(@xlink:href)/html:html/html:body/*">
(Whole bunch of code ommited)
</xsl:when>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<!-- We include an error message in the output document
if the intended behavior is not to embed the content -->
<p>Error: the <xstyle:component> elements only
support the xlink:show attribute set to the value "embed".</p>
</xsl:otherwise>
</xsl:choose>
but it still has not changed. I am using the saxon parser to convert to HTML
and
maybe its does not support advance syntax under test. Or maybe its the
operator
(me) that has it wrong. OH! by the way Dave, I also tried without the //
and
nothing. It either suppresses all of the graphics or none. Thanks for your
help
This is my code
<xsl:template match="image">
<xsl:choose>
<xsl:when test="contains
(@obj.id,'../packet/illust')">
</xsl:when>
<xsl:otherwise>
<SPAN style="
font-size: 10pt;
font-style: normal;
font-weight: bold;
vertical-align: center;
margin-right: 3pc;
width: 300;
height: 100">
<p>
<IMG >
<xsl:attribute name="SRC" >
<xsl:value-of select="@reference"/>
</xsl:attribute>
</IMG>
</p>
<xsl:value-of select="illust"/>
<xsl:apply-templates />
<p></p>
</SPAN>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Eddy
-----Original Message-----
From: David Carlisle [mailto:davidc@nag.co.uk]
Sent: Wednesday, March 29, 2000 7:28 PM
To: xsl-list@mulberrytech.com
Subject: Re: xsl:if and xsl:when
<xsl:template match="image">
<xsl:choose>
<xsl:when test="//illust/@obj.id=1">
you are matching on a particular image but your xsl:when test
asks whether there is any illust element anywhere in the document that
has an obj.id attribute with value 1. So will give the same result
on all images.
you almost certainly don't want that // at the start of the test
but without seeing your input format can't be sure exactly what it
should be.
David
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list