[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: XSLT Stylesheet query (newbie)

  • From: Robert Koberg <rob@k...>
  • To: Jack Bush <netbeansfan@y...>
  • Date: Mon, 12 Jan 2009 18:06:01 -0500

Re:  XSLT Stylesheet query (newbie)

On Jan 12, 2009, at 5:53 PM, Jack Bush wrote:

> Hi All,
>
> I need some advice on how to retrieve the value of 2 attributes  
> (@href, @title) in state.xml as part of transformation as follows:
>
>   <?xml version="1.0" encoding="UTF-8" ?>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd 
> ">
> - <html xmlns="http://www.w3.org/1999/xhtml" xmlns:html="http://www.w3.org/1999/xhtml 
> ">

You will most likely get better help from mulberrytech's XSL list.

AS for some hints, your content is in a namespace. You need to account  
for this when you 'match' it in your XSL.

> <xsl:for-each select="/html/body/div[@id='content']/ 
> table[@class='sresults']/tr/td/a">

This is in no namespace. In other words, you are not targeting your  
source XML.

Though I tend to almost always prefer xsl:apply-templates over xsl:for- 
each, either way you need to understand what you want to 'loop' over.  
How many 'a' elements exist at the path you specify?

You should probably go through soem tutorials, get Michael Kay's XSL  
book for XSL 1.0 - if you really want/need to use XSL/XPath 1.0. You  
would be better off starting with XSL/XPath 2.0, especially since you  
are using java on the server.

best,
-Rob



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.