1<?xml version="1.0" encoding="UTF-8"?> 2<!-- Bugzilla#4056 See also whitespace20.xsl for similar test of xml:space --> 3<!-- $RCSfile: Bugzilla4056.xsl,v $ $Revision$ $Date$ --> 4<xsl:stylesheet 5 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 6 version="1.0" 7 xmlns:java="http://xml.apache.org/xslt/java" 8 exclude-result-prefixes="java"> 9 <xsl:strip-space elements="*"/> 10 11 <xsl:template match="NewsML"> 12 <xsl:apply-templates select="NewsItem"/> 13 </xsl:template> 14 15 <xsl:template match="NewsItem"> 16 <EVENT xml:space="preserve"> 17 <xsl:attribute name="event-id"><xsl:value-of select="Identification/NewsIdentifier/PublicIdentifier"/>:<xsl:value-of select="Identification/NewsIdentifier/RevisionId"/></xsl:attribute> 18 <DIR name="content"> 19 <STRING name="headline"> 20 <xsl:choose> 21 <xsl:when test="string-length( NewsComponent/NewsLines/HeadLine )>0"> 22 <xsl:apply-templates select="NewsComponent/NewsLines/HeadLine/descendant-or-self::text()"/> 23 </xsl:when> 24 <xsl:otherwise> 25 <xsl:apply-templates select="NewsComponent/NewsLines/NewsLine[NewsLineType/@FormalName='alert'][1]/NewsLineText/descendant-or-self::text()"/> 26 </xsl:otherwise> 27 </xsl:choose> 28 </STRING> 29 <STRING name="story"> 30 <xsl:apply-templates select="NewsComponent/ContentItem/DataContent/descendant-or-self::text()"/> 31 </STRING> 32 </DIR> 33 <DIR name="meta"> 34 <xsl:apply-templates select="NewsComponent/TopicSet[@FormalName='ReutersMetaData']/Topic/Property[@FormalName='Code']" mode="meta"/> 35 36 <STRING name="provider"><xsl:value-of select="Identification/NewsIdentifier/ProviderId"/></STRING> 37 <STRING name="any"><xsl:value-of select="Identification/NewsIdentifier/ProviderId"/></STRING> 38 39 <xsl:variable name="attribution" select="NewsComponent/AdministrativeMetadata/Source/Party/@FormalName"/> 40 <xsl:if test="$attribution"> 41 <STRING name="attribution"><xsl:value-of select="$attribution"/></STRING> 42 <STRING name="any"><xsl:value-of select="$attribution"/></STRING> 43 </xsl:if> 44 45 <xsl:variable name="language" select="NewsComponent/DescriptiveMetadata/Language[1]/@FormalName"/> 46 <xsl:if test="$language"> 47 <STRING name="language"><xsl:value-of select="$language"/></STRING> 48 <STRING name="any"><xsl:value-of select="$language"/></STRING> 49 </xsl:if> 50 </DIR> 51 <DIR name="teasers"> 52 <STRING name="teaser0"/> 53 <STRING name="teaser1"/> 54 <STRING name="teaser2"/> 55 <STRING name="teaser3"/> 56 <STRING name="teaser4"/> 57 </DIR> 58 </EVENT> 59 </xsl:template> 60 61 <xsl:template match="Property" mode="meta"> 62 <STRING name="{../TopicType/@FormalName}"><xsl:value-of select="@Value"/></STRING> 63 <STRING name="any"><xsl:value-of select="@Value"/></STRING> 64 </xsl:template> 65 66 <!-- 67 * Licensed to the Apache Software Foundation (ASF) under one 68 * or more contributor license agreements. See the NOTICE file 69 * distributed with this work for additional information 70 * regarding copyright ownership. The ASF licenses this file 71 * to you under the Apache License, Version 2.0 (the "License"); 72 * you may not use this file except in compliance with the License. 73 * You may obtain a copy of the License at 74 * 75 * http://www.apache.org/licenses/LICENSE-2.0 76 * 77 * Unless required by applicable law or agreed to in writing, software 78 * distributed under the License is distributed on an "AS IS" BASIS, 79 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 80 * See the License for the specific language governing permissions and 81 * limitations under the License. 82 --> 83 84</xsl:stylesheet> 85