[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] XSLT test of xsl variable problem


Subject: Re: [xsl] XSLT test of xsl variable problem
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 3 Nov 2004 15:24:34 GMT

PS

you don't show your input format so perhaps this is OK but all your
templates of the form

    <xsl:template match="orion-web-app[@internationalize-resources]">
              <xsl:if test="internationalize-resources">
       <xsl:copy>
            <xsl:attribute
name="internationalize-resources">:[value]</xsl:attribute>
            <xsl:apply-templates
select="@*[not(name()='internationalize-resources')]"/>
            <xsl:call-template name="copy-content-no-attrs"/>
        </xsl:copy>

look rather strange.

eg this one matches orion-web-app elements if they have a
internationalize-resources
attribute, but never uses that attribute but rather tests to see if
there is a child element of that name. If there is such an element
it generates an attribute called internationalize-resources with
value :[value]


I would have guessed that you meant    
<xsl:if test="@internationalize-resources">
to test for an attribute, but then the test would be pointless as
youknow the element has such an attribute as it is in the match pattern.
So assuming you did mean to test for both element and attribute, the
above could more simply be written

   <xsl:template match="orion-web-app[internationalize-resources and @internationalize-resources]">
       <orion-web-app internationalize-resources=":[value]">
            <xsl:copy
select="@*[not(name()='internationalize-resources')]"/>
 <xsl:apply-templates/>
        </orion-web-app>
</xsl:template>


probably this template could also be combined with all teh others that
have similar format, but it depends a bit what you are trying to do.

Do you really need this :[value] substitution stuff? why not handle that
all in XSLT?

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________


Current Thread