Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

XML/RSS - How to pass Atom link href to xsl variable

Posted on 2012-04-06
3
Medium Priority
?
288 Views
Last Modified: 2012-12-09
I have an XML...

<channel>
<atom:link href="http://www.mysite.com/rss/?m=look" rel="self" type="application/rss+xml"/>
<title></title>
<link>http://www.site.com/content/</link>
<pubDate>Fri, 06 Apr 2012 19:28:44 CDT</pubDate>
<lastBuildDate>Fri, 06 Apr 2012 19:28:44 CDT</lastBuildDate>
<ttl>5</ttl> 

Open in new window


How to I pass the Atom link href (http://www.mysite.com/rss/?m=look) to the xsl variable below?

<xsl:variable name="thisurl" select="ATOM_HREF_LINK_HERE"/>

Open in new window


is that possible?
0
Comment
Question by:dimsouple
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 60

Accepted Solution

by:
Geert Bormans earned 2000 total points
ID: 37819109
<xsl:variable name="thisurl" select="/channel/atom:link/@href"/>

Open in new window


make sure you bind the atom namespace to the correct namespace uri
and that you have the variable in context

there is way too little context in this question to be more detailed
It is not whole of the XML source (the atom: namespace binding is missing)
and we don't know wheiter you need a global variable, wheither there is more than one channel in your atom and hat the context of the variable is.

But in general, the above should be it
0
 

Author Comment

by:dimsouple
ID: 37838281
A siample RSS feed is @
http://www.martellyhaiti.com/rss/?m=messages

The stylesheet is @
http://www.martellyhaiti.com/rss/rss.xsl

It works fine if I set:
<xsl:variable name="thisurl" select="'http://www.martellyhaiti.com/rss?m=messages'"/>

If I change it to:
<xsl:variable name="thisurl" select="/channel/atom:link/@href"/>

Open in new window

The rss page shows a blank page. What I am doing wrong?
0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 37838496
as I said...
make sure you bind the atom namespace to the correct namespace uri

make this your stylesheet element and it will work

<xsl:stylesheet version="1.1" 
	xmlns:atom="http://www.w3.org/2005/Atom" 
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

Open in new window


Note that in general it is not a good idea to use the stylesheet version 1.1
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Browsing the questions asked to the Experts of this forum, you will be amazed to see how many times people are headaching about monster regular expressions (regex) to select that specific part of some HTML or XML file they want to extract. The examp…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question