Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: How to increment a value?

From: stoggers@-----------.---------.---
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.
> >
> > 
> 
> 
> 


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent