I have a XML file like this one
<contents>
<content loid="1.0.71719207" type="images"/>
<content loid="1.0.71719207" type="images"/>
<content loid="1.0.71719207" type="images"/>
<content loid="1.0.71719207" type="images"/>
</contents>
With XSL I want to obtain the following XML:
<div class="Image_1"></div>
<div class="Image_2"></div>
<div class="Image_3"></div>
<div class="Image_4"></div>
So basically I need to perform a loop and for every <xsl:for-each select="contents/content">
to print out <div class="Image_N"></div
> where N
is the number of the node.
I'm trying with Altova simulator, but I don't know how to increment N
from 1 to number of nodes.
This is my code. I'm a beginner with XSL:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" omit-xml-declaration="yes" indent="no" encoding="utf-8" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" />
<xsl:template match="/">
<xsl:for-each select="contents/content">
<div class="EM_Story_Image_N"></div>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>