Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 4th, 2005, 05:40 AM
Authorized User
 
Join Date: Sep 2005
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default Variable

Hi,
i have this code

<xsl:template match="@src">
 <xsl:variable name="imgURL" select="src"></xsl:variable>
 <xsl:attribute name="src"><xsl:value-of select="$imgURL"/></xsl:attribute>
</xsl:template>

But the $imgURL value is always an empty string
i'm trying to catch the src attribute from an <img> node (in an HTML file) and change it, but i need the current src value, so i can do some logic with it
Thanks

 
Old October 4th, 2005, 05:48 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

select="src" means select="child::src", it selects a child element of the context node. But within <xsl:template match="@src"> the context node is an attribute, and attributes don't have children. Perhaps you just want select=".". Actually I'm not sure why you want a variable at all, but you haven't show us all your logic presumably.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old October 4th, 2005, 06:09 AM
Authorized User
 
Join Date: Sep 2005
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks for your help, it works now
I want to do some testing and parsing with the imgURL, but for simplification i didn't post it
Thanks






Similar Threads
Thread Thread Starter Forum Replies Last Post
Object variable or With block variable not set haidee_mccaffrey Classic ASP Professional 5 March 8th, 2007 03:34 PM
ASSIGNING A JAVA SCRIPT VARIABLE TO A XSL VARIABLE SOMANATHAN10 XSLT 1 February 21st, 2007 04:26 AM
object variable or with block variable not set Aoude BOOK: Beginning VB.NET Databases 1 February 24th, 2006 05:21 PM
Object variable or With block variable not set tparrish Pro VB Databases 1 May 25th, 2005 02:08 PM
Object variable or with block variable not set spacy ASP.NET 1.x and 2.0 Application Design 0 September 21st, 2004 12:19 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.