You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Jose Correia <jo...@exinet.co.za> on 2000/06/01 10:15:33 UTC
Re: testing attribute value
Thanks Paul that did help.
Ones question though what if I define:
<xsl:template match ="img">
<img xmlns:html="http://www.w3.org/TR/REC-html40"
xsl:use-attribute-sets="img-attributes">
<xsl:apply-templates/>
</img>
</xsl:template>
But I don't define the attribute set. Will the processor ignore it or crash?
Thanks
Jose
Paul_Dick@lotus.com wrote:
> Jose,
>
> You might try creating smaller sets and then including them when they are
> ready for use. For instance img-attr-set1 would be built from the
> attributes that are listed with the source. img-attr-set2 would be built
> from your other sources, and then eventually you could combine them all
> together with the following:
> xsl:use-attribute-sets="img-attr-set1 img-attr-set2"
>
> Paul
>
>
> jose@exinet.c
> o.za (Jose To: xalan-dev@xml.apache.org, Scott Boag/CAM/Lotus
> Correia) <Sc...@lotus.com>
> cc: (bcc: Paul Dick/CAM/Lotus)
> 05/31/2000 Subject: testing attribute value
> 07:10 AM
> Please
> respond to
> xalan-dev
>
>
>
> Hi guys
>
> I need to know something pretty urgently:
>
> Is there a way to specify inside the xsl file, that if an attribute of an
> element is not specified in the source file, then I musn't include it in
> the
> output file.
>
> e.g. Given this line in the source file:
> <img src="flood1.gif" hspace="3" vspace="5" align="right" />
>
> and this bit of the xsl file:
>
> <xsl:attribute-set name="img-attributes">
> <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
> <xsl:attribute name="class"><xsl:value-of select="
> @class"/></xsl:attribute>
> <xsl:attribute name="style"><xsl:value-of select="
> @style"/></xsl:attribute>
> <xsl:attribute name="title"><xsl:value-of select="
> @title"/></xsl:attribute>
> <xsl:attribute name="xml:lang"><xsl:value-of
> select="@xml:lang"/></xsl:attribute>
> <xsl:attribute name="align"><xsl:value-of select="
> @align"/></xsl:attribute>
> <xsl:attribute name="border"><xsl:value-of select="
> @border"/></xsl:attribute>
> <xsl:attribute name="hspace"><xsl:value-of select="
> @hspace"/></xsl:attribute>
> <xsl:attribute name="vspace"><xsl:value-of select="
> @vspace"/></xsl:attribute>
> <xsl:attribute name="src"><xsl:value-of select="@src"/></xsl:attribute>
> <xsl:attribute name="alt"><xsl:value-of select="@alt"/></xsl:attribute>
> <xsl:attribute name="longdesc"><xsl:value-of
> select="@longdesc"/></xsl:attribute>
> <xsl:attribute name="height"><xsl:value-of select="
> @height"/></xsl:attribute>
> <xsl:attribute name="width"><xsl:value-of select="
> @width"/></xsl:attribute>
> <xsl:attribute name="usemap"><xsl:value-of select="
> @usemap"/></xsl:attribute>
> </xsl:attribute-set>
> <xsl:template match ="img">
> <img xmlns:html="http://www.w3.org/TR/REC-html40"
> xsl:use-attribute-sets="img-attributes">
> <xsl:apply-templates/>
> </img>
> </xsl:template>
>
> If I run this the output will be something like:
> <img id="" class="" style="" title="" xml:lang="" align="right" border=""
> hspace="3" vspace="5" src="flood1.gif" alt="" longdesc="" height="" width
> =""
> usemap=""/>
>
> Is there a way such that only the attributes in the src file will get
> copied
> over? You might ask yourselves why not just copy it over but these elements
> I
> need to convert are a subset of a bigger set.
>
> Thanks in advance
> Jose Correia
>
> Scott Boag/CAM/Lotus wrote:
>
> > Thanks, I'll try and look into these tomorrow. In the latest CVS I put
> in
> > some defensive protection for the stack miss-pop. The variable ref
> > out-of-context dumps are more worrisome. But I have another bug on my
> > queue from someone else that I think is the same thing, so hopefully I
> will
> > get to the bottom of this soon!
> >
> > -scott
> >
> >
> > Christoph
> > Oehler To: xalan-dev@xml.apache.org
> > <coehler@iiic cc: (bcc: Scott
> Boag/CAM/Lotus)
> > .ethz.ch> Subject: Emptystack
> exception
> >
> > 05/31/2000
> > 04:09 AM
> > Please
> > respond to
> > xalan-dev
> >
> >
> >
> > Hi Scott
> >
> > >
> > >Christoph Oehler <co...@iiic.ethz.ch> wrote:
> > >> We're using Cocoon 1.7.2, Sun XML Parser 2 and Xalan 1.0.1. We're
> > getting
> > >> several unreproducable errors:
> > >
> > >Christoph, is there a sample XML and stylesheet you could give me to try
> > >and reproduce this problem (I understand the errors seem to be
> > >unreproducable, but at least it's a start...).
> > >
> > >-scott
> >
> > Here are two sample files plus a stacktrace. It is really strange, cause
> > most of the time it works just fine!!!
> >
> > Thanks a lot
> > Christoph
>
> --
>
> \=/, _-===-_-===-_-===-_-===-_-==-_
> | @___oo ( )_
> /\ /\ / (___,,,}_--= )
> ) /^\) ^\/ _) =_"Positive thinking - a great way )
> ) /^\/ _) (_ to face life" )
> ) _ / / _) ( Jose Correia )
> /\ )/\/ || | )_) (_ jose@exinet.co.za )
> < > |(,,) )__) ( jcorreia@global.co.za )
> || / \)___)\ (_ _)
> | \____( )___) )___ -==-_______-=====-___==
> \______(_______;;; __;;;
--
\=/, _-===-_-===-_-===-_-===-_-==-_
| @___oo ( )_
/\ /\ / (___,,,}_--= )
) /^\) ^\/ _) =_"Positive thinking - a great way )
) /^\/ _) (_ to face life" )
) _ / / _) ( Jose Correia )
/\ )/\/ || | )_) (_ jose@exinet.co.za )
< > |(,,) )__) ( jcorreia@global.co.za )
|| / \)___)\ (_ _)
| \____( )___) )___ -==-_______-=====-___==
\______(_______;;; __;;;