|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Conditional tagging in xsl:for-each
> I am new to XSLT, so please forgive me if this is a FAQ It is a FAQ and we forgive you http://www.dpawson.co.uk/xsl/sect2/N7450.html#d9550e13 Michael Kay http://www.saxonica.com/ (I > have found no useful reference on the web). I have the > following XML source (snippet): > > <children> > <child id="870"> > <file>dscn1095.jpg</file> > <title>Some text.</title> > </child> > <child id="871"> > <file>dscn1100.jpg</file> > <title>More text</title> > </child> > <child id="872"> > <file>dscn1101.jpg</file> > <title>Still more text.</title> > </child> > > The children should be transformed into a two-column table. I > tried this, which makes the XSLT processors choke: > > <xsl:template match="page[@type='galleries']/children"> > <table><tr> > <xsl:for-each select="child"> > <td><img><xsl:attribute name="src"><xsl:value-of > select="file" /></xsl:attribute></img><xsl:value-of > select="title" /></td> > <xsl:if test="not(position() mod 2)"></tr><tr></xsl:if> > </xsl:for-each> > </tr></table> > </xsl:template> > > Obviously, they don't like the closing </tr> tag following my > <xsl:if>. While I see the reason for the error, I cannot find > a way around it. Is there a way to achieve what I want with XSLT? > > Thanks, > > Jan > -- > There are 10 kinds of people: those who understand binary, > and those who don't
|
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
|

Cart








