Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Extracting date from XML comment [Thread Next] Re: Extracting date from XML commentTo: NULL Date: 11/2/2007 11:04:00 AM <ajrijken@h...> wrote in message news:1193991180.221530.287380@1...... >I have a XML a want to transform to another XML > with the following commentline > <!-- File generated on 15.10.2007 10:50:43 --> > > I need to extract the date and time and put that in a attribute > something like this: > > comment > > <xsl:template match="/"> > > <xsl:if test="comment()"> > <xsl:variable name="Datum"><xsl:copy-of select="."/></ > xsl:variable> <= here I like to do the extracting of the date > </xsl:if> > <Field> > <xsl:attribute name="Name">DATE/xsl:attribute> > <xsl:attribute name="Value"><xsl:value-of select="$Datum"/></ > xsl:attribute> > </Field> > </xsl:template> > > This is not working I get the message Invalid variable referenceError > in XPath expression, Invalid variable reference > > Any Idea on how to extract the date from teh comment? > > Astrid > Looks like your variable is out of scope. Change it to: <xsl:variable name="Datum"> <xsl:if test=... </xsl:variable> -- Joe Fawcett (MVP - XML) http://joe.fawcett.name | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
