[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] call-template returns nothing was [Newbie question]
Hi, I stripped out the namespace form th exml and it redners oputput, but none of my xsl:call-template seems to work. I know th eselect for the param is working as I tried outouting the select as a value-of and it output, so assume therefore that the select content is being forwarded to the template being called. But as I put the name of the param on it's own in the template being called either as name or $name I get that literal output, not the value of the select passed in? A second problem I noticed. The first 4 apply-templates match to, respectively 1 GeneralInformationBlock, 1 UnderlyingSecurities, 1 CorporateActionDetail and 2 CorporateActionOption. In the 2 CorporateActionOption I test for empty element using <xsl:if test="t:SecuritiesMovement!=''"> and <xsl:if test="t:CashPaymentDetails!=''">, but these do not seem to be working the output inside the xsl:if is being called regardless. Thx. David -----Original Message----- From: David at roamware [mailto:david@xxxxxxxxxxxxxx] Sent: 06 December 2004 18:50 To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: RE: FW: Newbie question Hi, Thanks, Tried that, but still no joy? Probably misinterpreted something? <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:t="http://tempuri.org/test.xsd"> <xsl:output method="text" indent="no" encoding="ISO-8859-1"/> <xsl:template match="/"> <xsl:apply-templates select="/t:CorporateActionAnnouncement/CorporateAction/GeneralInformationBlo ck"></xsl:apply-templates> <xsl:apply-templates select="/t:CorporateActionAnnouncement/CorporateAction/UnderlyingSecurities" ></xsl:apply-templates> <xsl:apply-templates select="/t:CorporateActionAnnouncement/CorporateAction/CorporateActionDetail "></xsl:apply-templates> <xsl:apply-templates select="/t:CorporateActionAnnouncement/CorporateAction/CorporateActionOption "></xsl:apply-templates> </xsl:template> <xsl:template match="t:GeneralInformationBlock"> testoutput<xsl:call-template name="funcmsglookup"><xsl:with-param name="codef" select="t:FunctionofMessage"/></xsl:call-template> moretestoutput </xsl:template> <xsl:template match="t:UnderlyingSecurities"> /<xsl:value-of select="t:UnderlyingSecurityISIN/Listing"/>/ </xsl:template> <xsl:template match="t:CorporateActionDetail"> test//<xsl:call-template name="dateformat"><xsl:with-param name="adate" select="t:RecordDate"/></xsl:call-template> </xsl:template> <xsl:template match="t:CorporateActionOption"> //<xsl:value-of select="t:CorporateActionOptionNumber"/> OP//<xsl:call-template name="caoptlookup"><xsl:with-param name="codea" select="t:CorporateActionOptionsCode"/></xsl:call-template> LT//<xsl:call-template name="defproclookup"><xsl:with-param name="codep" select="t:DefaultProcessingFlag"/></xsl:call-template> <xsl:if test="t:CashPaymentDetails!=''"> YD//<xsl:value-of select="t:DefaultProcessingFlag"/> S//<xsl:value-of select="t:CashPaymentDetails/GrossAmountPayable/Currency"/><xsl:value-of select="t:CashPaymentDetails/GrossAmountPayable/Currency"/> </xsl:if> <xsl:if test="t:SecuritiesMovement!=''"> B//<xsl:call-template name="debcredlookup"><xsl:with-param name="codee" select="t: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> Regards, David -----Original Message----- From: George Cristian Bina [mailto:george@xxxxxxx] Sent: 06 December 2004 18:28 To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: FW: Newbie question Hi David, That is because your XPath expressions match elements from no namespace while all the elements from your XML file are from http://tempuri.org/test.xsd namespace: > <CorporateActionAnnouncement xmlns="http://tempuri.org/test.xsd"> You should add in your stylesheet something like xmlns:t="http://tempuri.org/test.xsd" and then use the t prefix to refer to any element in your stylesheet, for instance instead of CorporateActionAnnouncement you should have t:CorporateActionAnnouncement. Best Regards, George --------------------------------------------------------------------- George Cristian Bina <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger http://www.oxygenxml.com David at roamware wrote: > 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|