I am trying to take an NOAA RSS feed (NOAA site says it uses ATOM and CAPS) and convert it for SharePoint using XSLT. I am new to this and have limited experience working in XSLT. Here is a sample of the feed.
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"
xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
xmlns:georss="http://www.georss.org/georss">
<id>urn:uuid:9ae4ae29-830f-4870-bace-0f70984b76bd</id><title>
TSUNAMI INFORMATION STATEMENT NUMBER 1 </title>
<updated>2022-01-29T03:00:32Z</updated>
<author>
<name>NWS PACIFIC TSUNAMI WARNING CENTER HONOLULU HI</name>
<uri>http://ntwc.arh.noaa.gov/</uri>
<email>[email protected]</email>
</author>
<icon>http://ntwc.arh.noaa.gov/images/favicon.ico</icon>
<link type="application/atom+xml" rel="self" title="self"
href="http://ntwc.arh.noaa.gov/events/xml/PAAQAtom.xml"/>
<link rel="related" title="Energy Map"
<entry>
<title>KERMADEC ISLANDS REGION</title><updated>2022-01-29T03:00:32Z</updated>
<geo:lat>-29.751</geo:lat>
<geo:long>-174.709</geo:long>
<summary type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<strong>Category:</strong> Information<br/>
<strong>Bulletin Issue Time: </strong> 2022.01.29 03:00:32 UTC
<br/><strong>Preliminary Magnitude: </strong>6.6(Mwp)<br/>
<strong>Lat/Lon: </strong>-29.751 / -174.709<br/>
<strong>Affected Region: </strong>KERMADEC ISLANDS REGION<br/>
</div>
</summary>
</entry>
</feed>
My problem is trying to convert the "summary type=xhtml" section into a readable format (like below) instead of a long run-on sentence.
CATEGORY: Information
BULLETIN ISSUE TIME:
PRELIMINARY MAGNITUDE:
Can someone provide me with some suggestions on how to parse the information in XSLT?
Thank you in advance.
AFAIK there is no standard format for the contents of an Atom
summary. If your data provider adheres to the format shown in your example, then - given a well-formed XML input such as:XML
you could do something like:
XSLT 1.0
to get:
Result