Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Output of copy-of into a variable?

From: Martin Honnen <mahotrash@-----.-->
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>&#xD;</xsl:text>
>             <xsl:value-of select="substring($VarName, 21, 40)"/>
>             <xsl:text>&#xD;</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/


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