tia_kamakshi
asked on
Spliting album after every 4th item to the next line
Spliting album after every 4th item to the next line
Hi Experts,
I have a gallery xml, which is used to display 4 albums in one row in the html file in order of seriol no (sno) as shown in attached picture.
I only node need to pick from the albums where attribute isCurrent="True"
and order in which album needs to be shown is in sno="1", sno="2"
Below is my album node where attribute isCurrent="True" and from my complete xml is attached
The small image (or thumb image) that needs to be displayed for the album will be the
first <thumbnail> or <thumbMedia> under <Media> node
<thumbnail>/Preview/stagin g/sevens/I mages/Burj _Khalifa.j pg</thumbn ail>
or
<thumbMedia>/Preview/stagi ng/sevens/ Images/Bur j_Khalifa. jpg</thumb Media>
under node <Media> album first node can be image or video
in case of Image, node will be <Image>
in case of Video, node will be <thumbMedia>
therefor result for below xml should be as follows:
<table>
<tr>
<td colspan="8"> 2011 Media Gallery</td>
</tr>
<tr>
<td> <img src="/Preview/staging/seve ns/Images/ img1.jpg"> </img> </td>
<td> <img src="/Preview/staging/seve ns/Images/ img2.jpg"> </img> </td>
<td> <img src="/Preview/staging/seve ns/VideoIm age/img3.j pg"></img> </td> <!-- Here first node in Media node is Video and other has Image node, so it node can be anything Video or Image-->
<td> <img src="/Preview/staging/seve ns/Images/ img4.jpg"> </img> </td>
</tr>
<tr>
<td> Album 1 </td>
<td> Album 2 </td>
<td> Album 3 </td>
<td> Album 4 </td>
</tr>
<tr>
<td><img src="/Preview/staging/seve ns/Images/ img5.jpg"> </img> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> Album 5 </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
<Albums name="2011 Media Gallery" isCurrent="True">
<Album name="Album 1" sno="1" id="tcm:501-638216">
<Media>
<Image sno="1">
<description>The Burj Image-Asit</description>
<thumbnail>/Preview/stagin g/sevens/I mages/img1 .jpg</thum bnail>
<bigImage>/Preview/staging /sevens/Im ages/Burj_ Khalifa.jp g</bigImag e>
<link></link>
</Image>
<Image sno="2">
<description>The Burj Image-Asit</description>
<thumbnail>/Preview/stagin g/sevens/I mages/Burj _Khalifa.j pg</thumbn ail>
<bigImage>/Preview/staging /sevens/Im ages/Burj_ Khalifa.jp g</bigImag e>
<link></link>
</Image>
</Media>
</Album>
<Album name="Album 3" sno="3" id="tcm:501-638216">
<Media>
<Video sno="1">
<description>The Burj Image-Asit</description>
<thumbMedia>/Preview/stagi ng/sevens/ VideoImage /img3.jpg< /thumbMedi a>
<bigMedia>/Preview/staging /sevens/Im ages/Burj_ Khalifa.jp g</bigMedi a>
<link></link>
</Video>
<Image sno="2">
<description>The Burj Image-Asit</description>
<thumbnail>/Preview/stagin g/sevens/I mages/Burj _Khalifa.j pg</thumbn ail>
<bigImage>/Preview/staging /sevens/Im ages/Burj_ Khalifa.jp g</bigImag e>
<link></link>
</Image>
</Media>
</Album>
<Album name="Album 2" sno="2" id="tcm:501-638216">
<Media>
<Image sno="1">
<description>The Burj Image-Asit</description>
<thumbnail>/Preview/stagin g/sevens/I mages/img2 .jpg</thum bnail>
<bigImage>/Preview/staging /sevens/Im ages/Burj_ Khalifa.jp g</bigImag e>
<link></link>
</Image>
</Media>
</Album>
<Album name="Album 4" sno="4" id="tcm:501-638216">
<Media>
<Image sno="1">
<description>The Burj Image-Asit</description>
<thumbnail>/Preview/stagin g/sevens/I mages/img4 .jpg</thum bnail>
<bigImage>/Preview/staging /sevens/Im ages/Burj_ Khalifa.jp g</bigImag e>
<link></link>
</Image>
</Media>
</Album>
<Album name="Album 5" sno="5" id="tcm:501-638216">
<Media>
<Image sno="1">
<description>The Burj Image-Asit</description>
<thumbnail>/Preview/stagin g/sevens/I mages/img5 .jpg</thum bnail>
<bigImage>/Preview/staging /sevens/Im ages/Burj_ Khalifa.jp g</bigImag e>
<link></link>
</Image>
</Media>
</Album>
</Albums>
Please help me in creating this complex xslt
Many Thanks
otherAlbum.jpg
ImageGallery.xml
Hi Experts,
I have a gallery xml, which is used to display 4 albums in one row in the html file in order of seriol no (sno) as shown in attached picture.
I only node need to pick from the albums where attribute isCurrent="True"
and order in which album needs to be shown is in sno="1", sno="2"
Below is my album node where attribute isCurrent="True" and from my complete xml is attached
The small image (or thumb image) that needs to be displayed for the album will be the
first <thumbnail> or <thumbMedia> under <Media> node
<thumbnail>/Preview/stagin
or
<thumbMedia>/Preview/stagi
under node <Media> album first node can be image or video
in case of Image, node will be <Image>
in case of Video, node will be <thumbMedia>
therefor result for below xml should be as follows:
<table>
<tr>
<td colspan="8"> 2011 Media Gallery</td>
</tr>
<tr>
<td> <img src="/Preview/staging/seve
<td> <img src="/Preview/staging/seve
<td> <img src="/Preview/staging/seve
<td> <img src="/Preview/staging/seve
</tr>
<tr>
<td> Album 1 </td>
<td> Album 2 </td>
<td> Album 3 </td>
<td> Album 4 </td>
</tr>
<tr>
<td><img src="/Preview/staging/seve
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> Album 5 </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
<Albums name="2011 Media Gallery" isCurrent="True">
<Album name="Album 1" sno="1" id="tcm:501-638216">
<Media>
<Image sno="1">
<description>The Burj Image-Asit</description>
<thumbnail>/Preview/stagin
<bigImage>/Preview/staging
<link></link>
</Image>
<Image sno="2">
<description>The Burj Image-Asit</description>
<thumbnail>/Preview/stagin
<bigImage>/Preview/staging
<link></link>
</Image>
</Media>
</Album>
<Album name="Album 3" sno="3" id="tcm:501-638216">
<Media>
<Video sno="1">
<description>The Burj Image-Asit</description>
<thumbMedia>/Preview/stagi
<bigMedia>/Preview/staging
<link></link>
</Video>
<Image sno="2">
<description>The Burj Image-Asit</description>
<thumbnail>/Preview/stagin
<bigImage>/Preview/staging
<link></link>
</Image>
</Media>
</Album>
<Album name="Album 2" sno="2" id="tcm:501-638216">
<Media>
<Image sno="1">
<description>The Burj Image-Asit</description>
<thumbnail>/Preview/stagin
<bigImage>/Preview/staging
<link></link>
</Image>
</Media>
</Album>
<Album name="Album 4" sno="4" id="tcm:501-638216">
<Media>
<Image sno="1">
<description>The Burj Image-Asit</description>
<thumbnail>/Preview/stagin
<bigImage>/Preview/staging
<link></link>
</Image>
</Media>
</Album>
<Album name="Album 5" sno="5" id="tcm:501-638216">
<Media>
<Image sno="1">
<description>The Burj Image-Asit</description>
<thumbnail>/Preview/stagin
<bigImage>/Preview/staging
<link></link>
</Image>
</Media>
</Album>
</Albums>
Please help me in creating this complex xslt
Many Thanks
otherAlbum.jpg
ImageGallery.xml
ASKER
Really Great. I really appreciate your mastery on xslt
Can you please help me in understanding what code "mod 4 = 1" is doing below
<xsl:apply-templates select="Album[@sno mod 4 = 1]">
Also, I have applied your xslt on attached "ImageGallery.xml"
I am attaching the output.
It is listing all the albums where isCurrent="False", but it should only pick all the albums
where <Albums> node has attribute isCurrent="True"
<Albums name="2011 Media Gallery" isCurrent="True">
It should not pick the resutls where <Albums> node has attribute isCurrent="False"
<Albums name="2010 Media Gallery" isCurrent="False">
Output result has below extra code after html table is closed
<tr>
<td>
<img src="/Preview/staging/seve ns/Images/ Burj_Khali fa.jpg" />
</td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>Jaipur Gallery</td>
<td> </td>
<td> </td>
<td> </td>
</tr>
Please help me in fixing this issue
Many Thanks for your great help
albumoutput.xml
Can you please help me in understanding what code "mod 4 = 1" is doing below
<xsl:apply-templates select="Album[@sno mod 4 = 1]">
Also, I have applied your xslt on attached "ImageGallery.xml"
I am attaching the output.
It is listing all the albums where isCurrent="False", but it should only pick all the albums
where <Albums> node has attribute isCurrent="True"
<Albums name="2011 Media Gallery" isCurrent="True">
It should not pick the resutls where <Albums> node has attribute isCurrent="False"
<Albums name="2010 Media Gallery" isCurrent="False">
Output result has below extra code after html table is closed
<tr>
<td>
<img src="/Preview/staging/seve
</td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>Jaipur Gallery</td>
<td> </td>
<td> </td>
<td> </td>
</tr>
Please help me in fixing this issue
Many Thanks for your great help
albumoutput.xml
ASKER
Also, on the output I donot wanted to write
<?xml version="1.0" encoding="utf-8"?>
on the start of the result
Please help me in fixing this as well
Many Thanks again
<?xml version="1.0" encoding="utf-8"?>
on the start of the result
Please help me in fixing this as well
Many Thanks again
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Really Great.
Many Thanks once again for helping me.
Best Regards
Many Thanks once again for helping me.
Best Regards
welcome
so 1, 2, 3, 4, 5
and not
1, 3, 4, 5
Open in new window