You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by bu...@apache.org on 2001/10/09 05:00:28 UTC

DO NOT REPLY [Bug 4034] New: - I am unabkle to create transformer for attached xsl file sing Simple Transform Program

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=4034>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=4034

I am unabkle to create transformer for attached xsl file sing Simple Transform Program

           Summary: I am unabkle to create transformer for attached xsl file
                    sing Simple Transform Program
           Product: XalanJ2
           Version: 2.0.0
          Platform: Other
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: org.apache.xalan.transformer
        AssignedTo: xalan-dev@xml.apache.org
        ReportedBy: manoj.mandke@tibcofinance.com


<?xml version="1.0"?> 
<!-- $RCSfile: Newsml2Headlineml.xsl,v $ -->
<xsl:stylesheet 
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
  version="1.0">
  <xsl:strip-space elements="*"/>

  <xsl:template match="NewsML">
	<xsl:apply-templates select="NewsItem"/>
  </xsl:template>

  <xsl:template match="NewsItem">
	<xsl:variable name="STATUS"><xsl:value-of 
select="NewsManagement/Status/@FormalName"/></xsl:variable>
	<xsl:variable name="HAS_ALERT"><xsl:value-of 
select="NewsComponent/NewsLines/NewsLine
[NewsLineType/@FormalName='alert']/NewsLineText/node()"/></xsl:variable>
	<xsl:variable name="HAS_HEADLINE"><xsl:value-of 
select="NewsComponent/NewsLines/HeadLine/text()"/></xsl:variable>
	<xsl:variable name="TYPE"><xsl:choose>
	  <xsl:when test="$HAS_ALERT and $HAS_HEADLINE">both</xsl:when>
	  <xsl:when test="$HAS_ALERT">alert</xsl:when>
	  <xsl:otherwise>story</xsl:otherwise>
	  <!--xsl:when test="NewsComponent/NewsLines/HeadLine/text() or 
$STATUS='Canceled'">story</xsl:when>
	  <xsl:otherwise>alert</xsl:otherwise-->
	</xsl:choose></xsl:variable>

	<HL xml:space="preserve">
	  <ID><xsl:value-of 
select="Identification/NewsIdentifier/PublicIdentifier"/></ID>
	  <RE><xsl:value-of 
select="Identification/NewsIdentifier/RevisionId"/></RE>
	  <ST><xsl:value-of select="$STATUS"/></ST>
	  <CT><xsl:value-of select="NewsManagement/FirstCreated"/></CT>
	  <RT><xsl:value-of select="NewsManagement/ThisRevisionCreated"/></RT>
	  <PR><xsl:value-of 
select="Identification/NewsIdentifier/ProviderId"/></PR>
	  <AT><xsl:value-of 
select="NewsComponent/AdministrativeMetadata/Source/Party/@FormalName"/></AT>
	  <TY><xsl:value-of select="$TYPE"/></TY>
	  <UR>4</UR>
	  <HT><xsl:choose>
		<xsl:when test="$STATUS='Canceled'">**** the story <xsl:value-
of select="Identification/NewsIdentifier/PublicIdentifier"/> was deleted 
***</xsl:when>
		<xsl:when test="$TYPE='story'"><xsl:apply-templates 
select="NewsComponent/NewsLines/HeadLine/node()" mode="copy"/></xsl:when>
		<xsl:otherwise><xsl:apply-templates 
select="NewsComponent/NewsLines/NewsLine[NewsLineType/@FormalName='alert']
[1]/NewsLineText/node()" mode="copy"/></xsl:otherwise>
	  </xsl:choose></HT>
	  <xsl:if test="$STATUS!='Canceled'">
		<LN><xsl:value-of 
select="NewsComponent/DescriptiveMetadata/Language[1]/@FormalName"/></LN>
		<PE><xsl:call-template name="matchCategory"><xsl:with-param 
name="param1" select="'headline_pes'"/></xsl:call-template></PE>
		<!--TO><xsl:call-template name="matchCategory"><xsl:with-param 
name="CATEGORY" select="'topics'"/></xsl:call-template></TO-->
		<CO><xsl:call-template name="matchCategory"><xsl:with-param 
name="CATEGORY" select="'companies'"/></xsl:call-template></CO>
	  </xsl:if>
	</HL>
  </xsl:template>

  <xsl:template name="matchCategory">
	<xsl:for-each select="NewsComponent/TopicSet
[@FormalName='ReutersMetaData']/Topic[TopicType/@FormalName=$param1]/Property
[@FormalName='Code']">
	  <xsl:if test="position()>1"><xsl:text> </xsl:text></xsl:if><xsl:value-
of select="@Value"/>
	</xsl:for-each>
  </xsl:template>

<!-- performs a deep copy of the matched node -->
  <xsl:template match="@*|node()" mode="copy">
	<xsl:copy>
	  <xsl:apply-templates select="@*" mode="copy" />
	  <xsl:apply-templates mode="copy" />
	</xsl:copy>
  </xsl:template>

</xsl:stylesheet>