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 June 9th, 2008, 01:32 PM
Registered User
 
Join Date: Jun 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Names within tags ?

Good day.

I have an xml file that has the following first line:

<batch userID = "FTUHRViewExtract" batchID = "FTUHRBatch.2008.06.09.14.21.10">

...and I'd like to display the userID and batchID fields in
the resulting transformed HTML file.

Does anyone know of a way in XSL to grab those two strings using
the tags 'userID' and 'batchID' ?

I've googled it and can't seem to find anything.

Any help is appreciated.
 
Old June 9th, 2008, 01:43 PM
Registered User
 
Join Date: Jun 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well, this figures.....
I discovered how to do this just after I posted this.

Use:

<xsl:for-each select="batch">
   ...table, tr, td, etc
    <xsl:value-of select="@userID" />
   ...other stuff...
</xsl:for-each>

I hope this helps someone else who's struggling....
 
Old June 9th, 2008, 03:52 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

It's hard to find thing on google unless you take the trouble to learn the terminology. userID and batchID are attributes. The thing from "<batch" to ">" is called a start tag; it marks the start of an element. People often use the word "tag" incorrectly to mean "element"; you are using it incorrectly to mean "attribute". With that kind of confusion, google doesn't stand a chance.

Wrox do some excellent books...

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old June 10th, 2008, 08:33 AM
Registered User
 
Join Date: Jun 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks, Michael.

I don't work with XSL enough to be knowledgeable to
that degree, but thanks to you and others, I'm getting
better.







Similar Threads
Thread Thread Starter Forum Replies Last Post
query for names cesarfranciso Pro VB Databases 31 April 15th, 2007 12:16 PM
To Many Names bachuss SQL Language 0 January 18th, 2006 12:40 PM
Constraint for names barkingstars Oracle 2 April 14th, 2004 01:29 PM
User Names Ben Horne Forum and Wrox.com Feedback 4 April 8th, 2004 08:30 AM
Get Folder names Jaco Jordaan ASP.NET 1.0 and 1.1 Basics 2 October 29th, 2003 12:04 PM





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