Purpose
Used in AFPNewsML workflow (part of the dataSrcFiles_AFPNewsML.xml).
Code
<?xml version="1.0" encoding="utf-8"?>
<!--
Simplified XSLT used to import AFP NewsML wires into the system
-->
<story name="{fn:createGuid()}" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:variable name="folderPath" select="$pars/*/add[@key='folderPath']/@value" />
<xsl:variable name="sourceName" select="$pars/*/add[@key='sourceName']/@value" />
<xsl:variable name="copyrightName" select="$pars/*/add[@key='copyrightName']/@value" />
<xsl:variable name="srcPath" select="$pars/*/add[@key='srcPath']/@value" />
<xsl:variable name="DescriptiveMetadata" select="NewsItem/NewsComponent/DescriptiveMetadata"/>
<xsl:variable name="NewsLines" select="NewsItem/NewsComponent/NewsLines"/>
<xsl:variable name="ContentItem" select="NewsItem/NewsComponent/ContentItem"/>
<xsl:variable name="publicIdentifier" select="NewsItem/Identification/NewsIdentifier/PublicIdentifier"/>
<xsl:variable name="title">
<xsl:choose>
<xsl:when test="string($NewsLines/HeadLine)">
<xsl:value-of select="$NewsLines/HeadLine"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$ContentItem/DataContent//p[1]"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="urgency" select="NewsItem/NewsManagement/Urgency/@FormalName"/>
<xsl:variable name="language" select="$DescriptiveMetadata/Language/@FormalName"/>
<xsl:attribute name="priority">
<xsl:choose>
<xsl:when test="$urgency < 4">
<xsl:text>high</xsl:text>
</xsl:when>
<xsl:when test="$urgency > 4">
<xsl:text>low</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>medium</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:if test="string($copyrightName)">
<rights>
<ref>
<keyVal>
<xsl:value-of select="$copyrightName"/>
</keyVal>
</ref>
</rights>
</xsl:if>
<xsl:if test="string($sourceName)">
<sourceRef>
<keyVal>
<xsl:value-of select="$sourceName"/>
</keyVal>
</sourceRef>
</xsl:if>
<sourceId>
<xsl:value-of select="$publicIdentifier"/>
</sourceId>
<followId>
<xsl:value-of select="$publicIdentifier"/>
</followId>
<sourceFileName>
<xsl:value-of select="fn:pathFileName($srcPath)"/>
</sourceFileName>
<keywords>
<xsl:for-each select="$DescriptiveMetadata/Property[@FormalName='Keyword']">
<item>
<xsl:value-of select="@Value"/>
</item>
</xsl:for-each>
</keywords>
<folderRef>
<keyVal>
<xsl:value-of select="$folderPath"/>
</keyVal>
</folderRef>
<title>
<xsl:value-of select="$title"/>
</title>
<authors>
<xsl:value-of select="$NewsLines/ByLine"/>
</authors>
<summary>
<xsl:value-of select="fn:trimText($ContentItem/DataContent,500,' ','...')"/>
</summary>
<!-- <location/> -->
<city>
<xsl:value-of select="$DescriptiveMetadata/Location/Property[@FormalName='City']/@Value"/>
</city>
<!-- <state/> -->
<xsl:if test="$DescriptiveMetadata/Location/Property[@FormalName='Country']/@Value != 'ZZZ'">
<country>
<xsl:value-of select="$DescriptiveMetadata/Location/Property[@FormalName='Country']/@Value"/>
</country>
</xsl:if>
<!-- <countryCode/> -->
<xmlText>
<xsl:for-each select="$ContentItem/DataContent//p">
<p>
<xsl:value-of select="."/>
</p>
</xsl:for-each>
</xmlText>
<xmlFormatRef>
<keyVal>XHTML</keyVal>
</xmlFormatRef>
</story>