Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: How to increment a value? [Thread Next] Re: How to increment a value?To: NULL Date: 12/5/2005 4:10:00 AM Hi, Many thanks for your response. The solution works but I was wondering if it would be possible to make it more generic? Obviously the source XMl is derived from a relational table and I have very many of these with additional columns apart from 'key'. Would it be possible to implement your solution so that it copies any elements across in addition to incrementing the uid element. Thanks, Mike. "Chris Lovett" wrote: > <?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" indent="yes"/> > <xsl:template match="/"> > <xsl:apply-templates select="node()"/> > </xsl:template> > <xsl:template match="*"> > <xsl:copy> > <xsl:apply-templates select="node()"/> > </xsl:copy> > </xsl:template> > <xsl:template match="@*"> > <xsl:copy> > <xsl:apply-templates select="node()"/> > </xsl:copy> > </xsl:template> > <xsl:template match="row[position()=1]"> > <row> > <xsl:copy-of select="key"/> > <uid> > <xsl:value-of select="uid + 1"/> > </uid> > </row> > </xsl:template> > </xsl:stylesheet> > > > > "stoggers" <stoggers@d...> wrote in message > news:DEB6079D-4342-4904-9A90-E44C45492F10@m...... > > Hi, > > > > I have the following file: > > > > <?xml version="1.0" encoding="UTF-8"?> > > <table> > > <row> > > <key>AAAAAA</key> > > <uid>1234</uid> > > </row> > > <row> > > <key>AAAAAA</key> > > <uid>1234</uid> > > </row> > > </table> > > > > And I would like to increment the value in 'uid' on just the first 'row'. > > > > How would I achieve this? > > > > Thanks, > > > > Stoggers. > > > > > > > | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
