[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: binary-or

Subject: RE: binary-or
From: "McNally, David" <David.McNally@xxxxxxxxxx>
Date: Wed, 25 Sep 2002 17:34:29 -0400
RE:  binary-or
I think this does what you want, though I didn't try all your test data.
It's not recursive - if that makes any difference.

<xsl:template name="or">
	<xsl:param name="operand1" select="''"/>
	<xsl:param name="operand2" select="''"/>
	<xsl:variable name="result1">
		<!-- would just return this if we didn't need to do the zero
padding -->
		<xsl:value-of select="translate(string(number($operand1) +
number($operand2)), '2', '1')"/>
	</xsl:variable>
	<xsl:choose>
		<xsl:when test="string-length($operand1) >
string-length($operand2)">
			<xsl:value-of
select="concat(substring($operand1,1,(string-length($operand1) -
string-length($result1))),$result1)"/>
		</xsl:when>
		<xsl:otherwise>
			<xsl:value-of
select="concat(substring($operand2,1,(string-length($operand2) -
string-length($result1))),$result1)"/>
		</xsl:otherwise>
	</xsl:choose>
</xsl:template>

With some thought the xsl:choose could probable be improved.

HTH
David.
--
David McNally            Moody's Investors Service
Software Engineer        99 Church St, NY NY 10007 
David.McNally@xxxxxxxxxx            (212) 553-7475

> -----Original Message-----
> From: Rubén [mailto:rubenm@xxxxxxxxxxxxx]
> Sent: Wednesday, September 25, 2002 4:35 PM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  binary-or
> 
> 
> 
> Hello list! I couldn't find a "binary-or" (or "mask-or") 
> operation in XPath 1.1 so I tried to
> emulate it with a template. I wrote a recursive 
> implementation but I'm not very
> happy with the result. I wonder if there is a simpler (and 
> maybe more efficient)
> solution. Any suggestions?
> 


---------------------------------------

The information contained in this e-mail message, and any attachment thereto, is confidential and may not be disclosed without our express permission.  If you are not the intended recipient or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that you have received this message in error and that any review, dissemination, distribution or copying of this message, or any attachment thereto, in whole or in part, is strictly prohibited.  If you have received this message in error, please immediately notify us by telephone, fax or e-mail and delete the message and all of its attachments.  Thank you.

Every effort is made to keep our network free from viruses.  You should, however, review this e-mail message, as well as any attachment thereto, for viruses.  We take no responsibility and have no liability for any computer virus which may be transferred via this e-mail message.


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread
  • Re[2]: binary-or, (continued)
      • Rubén - Thu, 26 Sep 2002 11:36:21 -0400 (EDT)
    • Rubén - Thu, 26 Sep 2002 11:43:54 -0400 (EDT)
    • Dion Houston - Wed, 25 Sep 2002 16:56:22 -0400 (EDT)
      • Rubén - Thu, 26 Sep 2002 11:42:27 -0400 (EDT)
    • McNally, David - Wed, 25 Sep 2002 17:33:05 -0400 (EDT) <=
      • Rubén - Thu, 26 Sep 2002 11:37:05 -0400 (EDT)
    • McNally, David - Thu, 26 Sep 2002 12:29:28 -0400 (EDT)

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.