XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] 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]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS