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 December 6th, 2014, 06:33 PM
Authorized User
 
Join Date: Jun 2013
Posts: 13
Thanks: 0
Thanked 1 Time in 1 Post
Default Global Variable declaration for attribute???

Hi All and thanks for this helpful forum. I've exhausted all my resources trying to save/display an attribute into a Global variable. I'm not getting an error, but nothing is being written to the variable. Thanks for any help...
Excerpt from My xslt:
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>
<xsl:variable name="ArcChoice"
select="/MissionProfile/Profile[@Name='Arc'][@Value]" />

Excerpt from My xml:
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type='text/xsl' href='MissionProfile.xsl'?>
<MissionProfile>
<Profile name="Arc" value="250"/>

I just need to capture the value of Profile, named "Arc"...
 
Old December 7th, 2014, 03:37 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

Firstly, xml and xslt are case sensitive, so @Name and @name are not the same thing.

Try :

Code:
/MissionProfile/Profile[@name='Arc']/@value
__________________
/- Sam Judson : Wrox Technical Editor -/

Think before you post: What have you tried?
 
Old December 7th, 2014, 03:51 AM
Authorized User
 
Join Date: Jun 2013
Posts: 13
Thanks: 0
Thanked 1 Time in 1 Post
Default

Thanks Sam, Your code worked fine. You guys always seem to come through for me when I'm at wits end...I do appreciate the help.
Jake





Similar Threads
Thread Thread Starter Forum Replies Last Post
using 2 xsi:schemaLocation and getting No matching global element declaration availab GETCODE XSLT 1 October 9th, 2009 07:28 AM
How to declare the global variable in global.asax? calyn_gately ASP.NET 3.5 Basics 0 August 6th, 2008 08:06 PM
Global declaration of a class object nrlahoti ASP.NET 2.0 Professional 5 October 14th, 2007 01:21 PM
Declaration of variable without initialization v_kewlani Other Programming Languages 0 May 24th, 2007 01:51 AM
i get error during declaration of variable srivastavaavivek Forum and Wrox.com Feedback 1 March 12th, 2007 09:42 AM





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