RE: xsl:choice
We'll I'll be darned. I didn't know you could use multiple when's like that. thx a lot -Matt -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Sunday, December 09, 2001 3:28 PM To: [EMAIL PROTECTED] Subject: RE: xsl:choice I think what Scott is trying to say that it is perfectly allowable XSLT to write: xsl:choose xsl:when test=test = '1' !-- Stuff for condition 1 -- /xsl:when xsl:when test=test = '2' !-- Stuff for condition 2 -- /xsl:when xsl:when test=test = 3' !-- Stuff for condition 3 -- /xsl:when xsl:when test=test = 4' !-- Stuff for condition 4 -- /xsl:when xsl:otherwise !-- Stuff fo the 'else' equivalent -- /xsl:otherwise /xsl:choose Joshua -Original Message- From: Matt Savino [mailto:[EMAIL PROTECTED]] Sent: Monday,10 December 2001 6:57 To: [EMAIL PROTECTED] Subject: Re: xsl:choice Yeah, it just gets a little cumbersome if you have, say, five cases. Scott Moore wrote: The xsl:choose statement is exactly like a switch or case statement. You CAN have one or more xsl:when statements underneath the same xsl:choose parent followed by one xsl:otherwise, which is equivalent to default: in Java or C++. I use this construct all the time, especially when I need something similiar to if then else or a switch statement. Scott - Original Message - From: Matt Savino [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, December 07, 2001 10:46 PM Subject: Re: xsl:choice Sorry, I didn't read the bottom. You can only include one xsl:when as a child of xsl:choose. (There is no concept of a case switch or elsif in XSLT.) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED] -- This message and any attachment is confidential and may be privileged or otherwise protected from disclosure. If you have received it by mistake please let us know by reply and then delete it from your system; you should not copy the message or disclose its contents to anyone. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
RE: xsl:choice
You can use it. -Original Message- From: Savino, Matt C [mailto:[EMAIL PROTECTED]] Sent: Monday, December 10, 2001 1:10 PM To: '[EMAIL PROTECTED]' Subject: RE: xsl:choice We'll I'll be darned. I didn't know you could use multiple when's like that. thx a lot -Matt -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Sunday, December 09, 2001 3:28 PM To: [EMAIL PROTECTED] Subject: RE: xsl:choice I think what Scott is trying to say that it is perfectly allowable XSLT to write: xsl:choose xsl:when test=test = '1' !-- Stuff for condition 1 -- /xsl:when xsl:when test=test = '2' !-- Stuff for condition 2 -- /xsl:when xsl:when test=test = 3' !-- Stuff for condition 3 -- /xsl:when xsl:when test=test = 4' !-- Stuff for condition 4 -- /xsl:when xsl:otherwise !-- Stuff fo the 'else' equivalent -- /xsl:otherwise /xsl:choose Joshua -Original Message- From: Matt Savino [mailto:[EMAIL PROTECTED]] Sent: Monday,10 December 2001 6:57 To: [EMAIL PROTECTED] Subject: Re: xsl:choice Yeah, it just gets a little cumbersome if you have, say, five cases. Scott Moore wrote: The xsl:choose statement is exactly like a switch or case statement. You CAN have one or more xsl:when statements underneath the same xsl:choose parent followed by one xsl:otherwise, which is equivalent to default: in Java or C++. I use this construct all the time, especially when I need something similiar to if then else or a switch statement. Scott - Original Message - From: Matt Savino [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, December 07, 2001 10:46 PM Subject: Re: xsl:choice Sorry, I didn't read the bottom. You can only include one xsl:when as a child of xsl:choose. (There is no concept of a case switch or elsif in XSLT.) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED] -- This message and any attachment is confidential and may be privileged or otherwise protected from disclosure. If you have received it by mistake please let us know by reply and then delete it from your system; you should not copy the message or disclose its contents to anyone. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: xsl:choice
The xsl:choose statement is exactly like a switch or case statement. You CAN have one or more xsl:when statements underneath the same xsl:choose parent followed by one xsl:otherwise, which is equivalent to default: in Java or C++. I use this construct all the time, especially when I need something similiar to if then else or a switch statement. Scott - Original Message - From: Matt Savino [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, December 07, 2001 10:46 PM Subject: Re: xsl:choice Sorry, I didn't read the bottom. You can only include one xsl:when as a child of xsl:choose. (There is no concept of a case switch or elsif in XSLT.) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: xsl:choice
Try xsl:choose. I'm available for consulting. Edward Dowgiallo wrote: I seem to be not getting the intended use of xsl:choice. The following stylesheet segment causes fop to terminate with the message: ...; Line 78 Column 25; [ERROR]: null fo:block font-family=Helvetica font-size=18pt text-align=end xsl:choice xsl:when test=//eraname xsl:value-of select=//eraname/ /xsl:when xsl:when test=//conflictname xsl:value-of select=//conflictname/ /xsl:when xsl:otherwise xsl:textHistory of the World/xsl:text /xsl:otherwise xsl:choice /fo:block 1st, a more verbose error message would be useful. 2nd, What I am trying to do is find out if the current element contains an element named eraname, if it does I want to use the value of the element eraname If it doesn't I want to check if the current element contains a child element named conflictname, if it does I want to use the value of the element conflictname. If it doesn't I want to slap in some boiler plate text. The xml file being processed when this fails does contain the child element eraname. I'd be more than happy to use a workaround here. Thank you, Ed - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: xsl:choice
Sorry, I didn't read the bottom. You can only include one xsl:when as a child of xsl:choose. (There is no concept of a case switch or elsif in XSLT.) test=//eraname returns true if there is an element eraname anywhere in the document. To search only the children of the current node, take out the '//' part. To do what you want try this (anyone knows of a more elegant method, please chime in): fo:block font-family=Helvetica font-size=18pt text-align=end xsl:choose xsl:when test=eraname or conflictname xsl:choose xsl:when test=eraname xsl:value-of select=eraname/ /xsl:when xsl:otherwise xsl:value-of select=conflictname/ /xsl:otherwise /xsl:choose /xsl:when xsl:otherwise xsl:textHistory of the World/xsl:text /xsl:otherwise /xsl:choose /fo:block Edward Dowgiallo wrote: I seem to be not getting the intended use of xsl:choice. The following stylesheet segment causes fop to terminate with the message: ...; Line 78 Column 25; [ERROR]: null fo:block font-family=Helvetica font-size=18pt text-align=end xsl:choice xsl:when test=//eraname xsl:value-of select=//eraname/ /xsl:when xsl:when test=//conflictname xsl:value-of select=//conflictname/ /xsl:when xsl:otherwise xsl:textHistory of the World/xsl:text /xsl:otherwise xsl:choice /fo:block 1st, a more verbose error message would be useful. 2nd, What I am trying to do is find out if the current element contains an element named eraname, if it does I want to use the value of the element eraname If it doesn't I want to check if the current element contains a child element named conflictname, if it does I want to use the value of the element conflictname. If it doesn't I want to slap in some boiler plate text. The xml file being processed when this fails does contain the child element eraname. I'd be more than happy to use a workaround here. Thank you, Ed - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]