p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

xslt thread: To extract the value of an XML element and use it as an attribute ?


Message #1 by Tero Ahola <TAH@s...> on Mon, 23 Sep 2002 08:53:05 +0200
<xsl:number/> is an XSLT instruction not an XPath expression, so you
can't use it directly in a place where an XPath expression is expected.

What you can do is this:

<xsl:variable name="n">
  <xsl:number level="any"/>
</xsl:variable>
<xsl:document href="{$n}.xml"/>

Michael Kay
Software AG
home: Michael.H.Kay@n...
work: Michael.Kay@s... 

> -----Original Message-----
> From: Tero Ahola [mailto:TAH@s...] 
> Sent: 23 September 2002 07:53
> To: P2P_XSLT
> Subject: [xslt] To extract the value of an XML element and 
> use it as an attribute ?
> 
> 
> Hi!
> What I was trying to do is to insert an value inside an 
> attribute as for
> example in the xsl:document write generate-id inside an attribute.
> <xsl:document method="xml" encoding="ISO-8859-1" 
> href="{generate-id()}.xml">
> This works just fine. But then I tried to use 
> <xsl:number-level="any"/> in
> the place for href like the following:
> <xsl:document method="xml" encoding="ISO-8859-1" href="{number
> level='any'/}.xml"> 
> Can I use number-level in the way I'm trying to do and if the 
> answer is no
> what shall I do to get the same result?
> Regards Tero
> 
> 
> 
> ---
> In developing the .NET Framework Microsoft has 
> taken XML to heart, and with ASP.NET representing 
> the cutting edge of Windows based web development, 
> Professional ASP.NET XML with C# has been published 
> to help web developers to appreciate how these 
> technologies can work together to provide 
> functional, powerful applications. 
> http://www.wrox.com/acon11.asp?ISBN=1861007345
> 


  Return to Index