[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Subdividing sets of elements by sequence identifiers
I have an "almost works" situation. The template and simplified input are
below. What I want to is "re-wrap images with consecutive image numbers (in
my output example "27,28,29") in a new <h6> element for HTML display
purposes. To do this,at the beginning of such a sequence, I must close off
the <h6> inserted by the current template with a </h6> and open a new <h6>.
Here only one sequence is shown, but several are possible within each
element.
I suspect I am thinking about this procedurally rather than imperatively, and thus cannot see the forest for the trees. All suggestions appreciated. Mark Selection from current output: <List> <h1>Art on Stamps</h1> <h2>1993</h2> <h6> <a href="../img/1993/5.jpg" target="_blank"> <img src="../img/1993/5.jpg" alt="stamp image" width="100" border="2px"></img> </a> <!-- ********** need to insert </h6><h6> here ************* --> <a href="../img/1993/27.jpg" target="_blank"> <img src="../img/1993/27.jpg" alt="stamp image" width="100" border="2px"></img> </a> <a href="../img/1993/28.jpg" target="_blank"> <img src="../img/1993/28.jpg" alt="stamp image" width="100" border="2px"></img> </a> <a href="../img/1993/29.jpg" target="_blank"> <img src="../img/1993/29.jpg" alt="stamp image" width="100" border="2px"></img> </a> </h6> ...... </List> My Template: <xsl:template match="Item"> <h1> <xsl:value-of select="@concept"></xsl:value-of> </h1> <xsl:for-each-group select="Stamp" group-by="Date/@year"> <xsl:sort select="Date/@year"></xsl:sort> <h2> <xsl:value-of select="Date/@year"></xsl:value-of> </h2> <h6> <xsl:for-each select="current-group()"> <xsl:variable name="image" select="concat('../img/', Date/@year, '/', @image-number, '.jpg')"></xsl:variable> <a href="{$image}" target="_blank"> <img src="{$image}" alt="stamp image" width="100" border="2px"></img> </a> </xsl:for-each> </h6> </xsl:for-each-group> </xsl:template> My Input: (simplified to a single <Item> from the <List> <List> <Item concept="Art on Stamps"> <Stamp image-number="5"> <Date year="1993"></Date> </Stamp> <Stamp image-number="27" > <Date year="1993"></Date> </Stamp> <Stamp image-number="28"> <Date year="1993"></Date> </Stamp> <Stamp image-number="29" > <Date year="1993"></Date> </Stamp> <Stamp image-number="42" > <Date year="1994"></Date> </Stamp> <Stamp image-number="43"> <Date year="1994"></Date> </Stamp> <Stamp image-number="44"> <Date year="1994"></Date> </Stamp> <Stamp image-number="57" > <Date year="1994" ></Date> </Stamp> <Stamp image-number="58"> <Date year="1994"></Date> </Stamp> <Stamp image-number="59"> <Date year="1994"></Date> </Stamp> <Stamp image-number="96"> <Date year="1995"></Date> </Stamp> <Stamp image-number="97" > <Date year="1995"></Date> </Stamp> <Stamp image-number="98"> <Date year="1995" ></Date> </Stamp> </Item> </List>
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|