Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: [xml-dev] XSLT Stylesheet query (newbie)

From: Robert Koberg <rob@------.--->
To: Jack Bush <netbeansfan@-----.---.-->
Date: 1/12/2009 11:06:00 PM
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


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent