[xsl] attribute management

Subject: [xsl] attribute management
From: "bix xslt" <bix_xslt@xxxxxxxxxxx>
Date: Thu, 21 Nov 2002 16:10:45 +0000
All,

I've run into some difficulty attempting to define an attribute. Essentially, I'm getting excess spaces, and I'd really like them removed while keeping the formatting the same for readability. Below is a sample xml and xslt.

Essentially, I'm trying to setup a 'default' set of options at the top of the xml file, and then specifics are found under the icon tags below.

Any help would be appreciated!
Thanks,
Brian

XML:

<content>
 <uri>
   <dir>./pics</dir>
   <root>btn</root>
   <img_ext>gif</img_ext>
   <link_ext>html</link_ext>
 </uri>
 <target>body</target>
 <icon id="cont_mot">
   <text>Motivation</text>
   <uri><root>mot</root></uri>
 </icon>
 <icon id="cont_req">
   <text>Requirements</text>
   <uri><root>req</root></uri>
 </icon>
</content>


XSLT:


 <xsl:template name="uri">
   <xsl:attribute name="background">
     <xsl:choose>
       <xsl:when test="./uri/dir">
         <xsl:value-of select="./uri/dir" />
       </xsl:when>
       <xsl:otherwise>
         <xsl:value-of select="/content/uri/dir" />
       </xsl:otherwise>
     </xsl:choose>/

     <xsl:choose>
       <xsl:when test="./uri/root">
         <xsl:value-of select="./uri/root" />
       </xsl:when>
       <xsl:otherwise>
         <xsl:value-of select="/content/uri/root" />
       </xsl:otherwise>
     </xsl:choose>.

     <xsl:choose>
       <xsl:when test="./uri/img_ext">
         <xsl:value-of select="./uri/img_ext" />
       </xsl:when>
       <xsl:otherwise>
         <xsl:value-of select="/content/uri/img_ext" />
       </xsl:otherwise>
     </xsl:choose>
   </xsl:attribute>
 </xsl:template>




_________________________________________________________________
Help STOP SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail



XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread