Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Output of copy-of into a variable? >Thread Next - Re: Output of copy-of into a variable? Re: Output of copy-of into a variable?To: NULL Date: 1/9/2009 12:57:00 PM michael.skovfoged@g... wrote: > I want to transform nodes into a file with a maximum linewidth. > Therefore I need to have the output result of copy-of into a variable > and then use substring to output a specific number of characters on > each line. I have tried: > > <xsl:variable name="VarName"> > <xsl:copy-of select="."/> > </xsl:variable> > <xsl:value-of select="substring($VarName, 1, 20)"/> > <xsl:text>
</xsl:text> > <xsl:value-of select="substring($VarName, 21, 40)"/> > <xsl:text>
</xsl:text> > > But this does not give the nodenames etc. and I can understand why as > the variable contains the node. > > Does anyone know how to do this? I don't understand what you want to achieve. substring operates on string values, whether you pass in a variable or some other expression does not matter. If you want to operate on the markup of nodes then you first need to serialize a node, Saxon (an XSLT 2.0 processor) has an extension function for that: http://www.saxonica.com/documentation/extensions/functions/serialize.html If you want to parse a string with XML markup back into nodes then you can use http://www.saxonica.com/documentation/extensions/functions/parse.html -- Martin Honnen --- MVP XML http://JavaScript.FAQTs.com/ | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
