MY requirement is here to print all values of <item name="BrowseVideoFile"> from below xml but if foreach loop runs and according to the position of for-each loop, then for that position video should not print and all others video should print.

when for-each run then every video should print except the postion of that instance video.

For example: if position is 1 of for-each loop, then it should print 

video2
video3
video4
video5
video6
video7

Similarly if for position 2nd, the output should be 
video1
video3
video4
video5
video6
video7

Hope this is clear. I am not able to think how this could be achieve. If any one of you have solution please share.


* -------Below is the xml--------

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="for-test.xsl"?>
<record name="advance" type="content">
        <item name="Products">
                    <item name="DetailsContainer">       
                            <item name="DetailDescriptionContainer">
                                    <item name="VideoDescriptionContainer">
                                            <item name="BrowseVideoFile">Video1</item>
                                            <item name="BrowseVideoFile">Video2</item>
                                            <item name="BrowseVideoFile">Video3</item>
                                            <item name="BrowseVideoFile">Video4</item>
                                            <item name="BrowseVideoFile">Video5</item>
                                    </item>
                            </item>
                            <item name="DetailDescriptionContainer">
                                    <item name="VideoDescriptionContainer">  
                                            <item name="BrowseVideoFile">Video6</item>
                                            <item name="BrowseVideoFile">Video7</item>
                                            <item name="BrowseVideoFile"></item>
                                    </item>
                            </item>
                    </item>
        </item>
</record>


*--- and xsl---

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="html"/>
<xsl:template match="/">

<xsl:for-each select="/record/item[@name='Products']/item[@name='DetailsContainer']/item[@name='DetailDescriptionContainer']/item[@name='VideoDescriptionContainer']/item[@name='BrowseVideoFile']/">
<xsl:value-of select="."/><br/>

</xsl:for-each>   


</xsl:template>

</xsl:stylesheet>

Edited 4 Years Ago by neerajkumar.in

How is position determined? A variable passed to the XSLT? The position within the loop in XSLT? Etc?

Edited 4 Years Ago by Mike Askew

This article has been dead for over six months. Start a new discussion instead.