[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

simple Problem I guess!!!!

Subject: simple Problem I guess!!!!
From: "sanjeev ramachandra" <sanjeev_scifi@xxxxxxxxxxx>
Date: Fri, 14 Apr 2000 16:26:06 CDT
how create node in guess
Hi,

I have got a small problem with XSL.

I want to create an element with two attributes like this

<departureDate xsd:type="java.sql.Date" xsd:null="1"/>

I have defined the names spaces for the xsd.

I tried adding two attributes to the same element but it adds only one. Is there any way I can do it?

Help me out !!!!

Sanjeev N R
IBM, Austin,Texas

From: Steve Tinney <stinney@xxxxxxxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxx
To: xsl-list@xxxxxxxxxxxxxxxx
Subject: Re: string-length
Date: Sun, 02 Apr 2000 11:41:19 -0400

> I want to select all nodes (in order) as long as the additive
> string length is less then 915
> <CATEGORY>
>         <DATA>
>                 ....
>         </DATA>
>         <DATA>
>                 ....
>         </DATA>

Use recursion, and pass the length of cumulative length of your string
as a parameter.  Wrap the whole thing inside a variable.

 <xsl:variable name="str">
   <xsl:call-template name="add-data"/>
 </xsl:variable>

 <xsl:template name="add-data">
   <xsl:param name="strlen" select="0"/>
   <xsl:param name="index" select="1"/>
   <xsl:if test="strlen &lt; 915">
     <xsl:value-of select="DATA[$index]"/>
   </xsl:if>
   <xsl:if test="$index &lt;= count(DATA)">
     <xsl:call-template name="add-data">
       <xsl:with-param name="strlen"
                select="$strlen+string-length(DATA[$index])"/>
       <xsl:with-param name="index"
                select="$index+1"/>
     </xsl:call-template>
   <xsl:if>
 </xsl:template>

(Untested, and probably not exactly what you want when, e.g., the first
DATA node has more than 915 characters, but you get the idea)

Steve


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

______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com


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



Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.