This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Tricky problem, limiting the number of source elements processed.


If the <typeA> elements precede the <typeB>s, can't you just write

<xsl:for-each select="(typeA | typeB)[position() &lt; 6]">
?
Mike Kay

> 
> I am having difficulties figuring out how to do this, so any 
> help is greatly
> appreciated. 
> 
> Lets say you have two types of elements, "typeA" and "typeB" 
> that you want
> to display, but you only want to display a maximum number of 
> them, say five.
> More particularly, you want to display as many of typeA as 
> possible, up to
> the limit of five, but if there are less than five typeAs, 
> the remaining
> space should be filled with typeBs.
> 
> So if you have say:
> <typeA>A1</typeA>
> <typeA>A2</typeA>
> <typeA>A3</typeA>
> <typeA>A4</typeA>
> <typeB>B1</typeB>
> <typeB>B2</typeB>
> <typeB>B3</typeB>
> 
> , that is 4 typeAs and 3 typeBs, you would get: 
> 
> A1, A2, A3, A4, B1.
> 
> as there is one space remaining for a typeB element.
> 
> Thanks.
> 
> 
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]