Subject: [xsl] FW: Newbie question From: "David at roamware" <david@xxxxxxxxxxxxxx> Date: Mon, 6 Dec 2004 18:16:26 -0000 |
Hi, I am new to XSLT. I have been using Treebeard as my editor. I get no errors, but also no output. I have spent ages looking at the xsl and cannot see what is wrong. One thing not entirely clear to me is how the context changes, this is not well epxlained anywhere I have looked. So I tend to use absolute XPath expressions. Here is my test.xml <?xml version="1.0" encoding="iso-8859-1"?> <CorporateActionAnnouncement xmlns="http://tempuri.org/test.xsd"> <AnnouncementDetails> <Released>2004-09-27</Released> </AnnouncementDetails> <Announcement> <Title>test</Title> </Announcement> <CorporateAction> <GeneralInformationBlock> <FunctionofMessage>2</FunctionofMessage> </GeneralInformationBlock> <UnderlyingSecurities> <UnderlyingSecurityISIN> <Listing>PLIS</Listing> </UnderlyingSecurityISIN> </UnderlyingSecurities> <CorporateActionDetail> <RecordDate>2004-08-20</RecordDate> </CorporateActionDetail> <CorporateActionOption> <CorporateActionOptionNumber>001</CorporateActionOptionNumber> <CorporateActionOptionsCode>Securities Option</CorporateActionOptionsCode> <DefaultProcessingFlag>1</DefaultProcessingFlag> <CashPaymentDetails> <PaymentDate>2004-10-06</PaymentDate> </CashPaymentDetails> <SecuritiesMovement> <DebitCreditIndicator></DebitCreditIndicator> </SecuritiesMovement> </CorporateActionOption> <CorporateActionOption> <CorporateActionOptionNumber>002</CorporateActionOptionNumber> <CorporateActionOptionsCode>Securities Option</CorporateActionOptionsCode> <DefaultProcessingFlag>2</DefaultProcessingFlag> <CashPaymentDetails> <PaymentDate></PaymentDate> </CashPaymentDetails> <SecuritiesMovement> <DebitCreditIndicator>Credit</DebitCreditIndicator> </SecuritiesMovement> </CorporateActionOption> </CorporateAction> </CorporateActionAnnouncement> Here is my xsl <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="text" indent="no" encoding="ISO-8859-1"/> <xsl:template match="/"> <xsl:apply-templates select="/CorporateActionAnnouncement/CorporateAction/GeneralInformationBlock "></xsl:apply-templates> <xsl:apply-templates select="/CorporateActionAnnouncement/CorporateAction/UnderlyingSecurities">< /xsl:apply-templates> <xsl:apply-templates select="/CorporateActionAnnouncement/CorporateAction/CorporateActionDetail"> </xsl:apply-templates> <xsl:apply-templates select="/CorporateActionAnnouncement/CorporateAction/CorporateActionOption"> </xsl:apply-templates> </xsl:template> <xsl:template match="GeneralInformationBlock"> testoutput<xsl:call-template name="funcmsglookup"><xsl:with-param name="codef" select="FunctionofMessage"/></xsl:call-template> moretestoutput </xsl:template> <xsl:template match="UnderlyingSecurities"> /<xsl:value-of select="UnderlyingSecurityISIN/Listing"/>/ </xsl:template> <xsl:template match="CorporateActionDetail"> test//<xsl:call-template name="dateformat"><xsl:with-param name="adate" select="RecordDate"/></xsl:call-template> </xsl:template> <xsl:template match="CorporateActionOption"> //<xsl:value-of select="CorporateActionOptionNumber"/> OP//<xsl:call-template name="caoptlookup"><xsl:with-param name="codea" select="CorporateActionOptionsCode"/></xsl:call-template> LT//<xsl:call-template name="defproclookup"><xsl:with-param name="codep" select="DefaultProcessingFlag"/></xsl:call-template> <xsl:if test="CashPaymentDetails!=''"> YD//<xsl:value-of select="DefaultProcessingFlag"/> S//<xsl:value-of select="CashPaymentDetails/GrossAmountPayable/Currency"/><xsl:value-of select="CashPaymentDetails/GrossAmountPayable/Currency"/> </xsl:if> <xsl:if test="SecuritiesMovement!=''"> B//<xsl:call-template name="debcredlookup"><xsl:with-param name="codee" select="DebitCreditIndicator"/></xsl:call-template> MOVE </xsl:if> MOREOUT </xsl:template> <xsl:template name="funcmsglookup"> <xsl:param name="codef"/> <xsl:if test="codef=0"><xsl:text></xsl:text>NEWM</xsl:if> <xsl:if test="codef=1"><xsl:text>REPL</xsl:text></xsl:if> <xsl:if test="codef=2"><xsl:text>CANC</xsl:text></xsl:if> </xsl:template> <xsl:template name="caoptlookup"> <xsl:param name="codea"/> <xsl:if test="codea=0"></xsl:if> <xsl:if test="codea=1"><xsl:text>CASH</xsl:text></xsl:if> <xsl:if test="codea=2"><xsl:text>SECU</xsl:text></xsl:if> </xsl:template> <xsl:template name="debcredlookup"> <xsl:param name="codee"/> <xsl:if test="codee=0"></xsl:if> <xsl:if test="codee=1"><xsl:text>CRED</xsl:text></xsl:if> <xsl:if test="codee=2"><xsl:text>DEBT</xsl:text></xsl:if> </xsl:template> <xsl:template name="defproclookup"> <xsl:param name="codep"/> <xsl:if test="codep=0"></xsl:if> <xsl:if test="codep=1"><xsl:text>Y</xsl:text></xsl:if> <xsl:if test="codep=2"><xsl:text>N</xsl:text></xsl:if> </xsl:template> <xsl:template name="dateformat"> <xsl:param name="adate"/> <xsl:text>substring($adate,0,4)substring($adate,5,2)substring($adate,8,2)</x sl:text> </xsl:template> </xsl:stylesheet> where am I going wrong? Thx. David
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] How to combine consecutiv, JBryant | Thread | Re: [xsl] FW: Newbie question, George Cristian Bina |
Re: [xsl] selecting multiple elemen, David Carlisle | Date | RE: [xsl] Saxon param to supress ou, Robert Soesemann |
Month |