Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - How to simplify? >Thread Next - Re: How to simplify? Re: How to simplify?To: NULL Date: 6/7/2008 2:28:00 PM Hvid Hat wrote: > I've got the following XSLT that works but I'm trying to figure out how to > simplify it. There is only one Image, so I don't need the for-each-loop. > Anyone? > > <xsl:for-each select="Data[@Name='Image']/img"> > <xsl:copy> > <xsl:copy-of select="@*"/> > <xsl:attribute name="class">right</xsl:attribute> > <xsl:apply-templates/> > </xsl:copy> > </xsl:for-each> xsl:copy needs a context node so I don't think you can get rid of the xsl:for-each as that sets up the 'img' element as the context node. If that stylesheet creates HTML or XHTML then you could drop the xsl:apply-templates as 'img' elements in HTML or XHTML are empty. -- Martin Honnen http://JavaScript.FAQTs.com/ | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
