One or two XSLT/XPath bugs

I have an XSLT problem that may actually be two problems. My stylesheet works as expected in MSXML and Xalan but does very weird things in Oracle's XSLT processor. Below is the stylesheet, followed by some test input. It looks like just one bug if you run it on this test input (the "extra rows" generated get numbered 10-14 rather than 20-24, but $count and $remainder seem to have the right values). If you delete all COWS after SEQNUM 13, however, then $count and $remainder are both wrong. So it may be one bug, may be two.
XSLT:
====================================================
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
     <!-- output a CHICKENROW for each CHICKEN in the source document, and guarantee there's a positive multiple of 8 rows total -->
     <xsl:template match="/">
          <CHICKENROWS>
               <xsl:for-each select="/COWS/COW[KEY1 = '1']">
                    <CHICKENROW seqnum="{SEQNUM}">
                         <xsl:value-of select="CHICKEN"/>
                    </CHICKENROW>
               </xsl:for-each>
               <xsl:variable name="count" select="count(/COWS/COW[KEY1 = '1'])"/>
               <!-- uncomment this for debugging
               <count><xsl:value-of select="$count"/></count>
               -->
               <xsl:variable name="remainder" select="$count mod 8"/>
               <!-- uncomment this for debugging
               <remainder><xsl:value-of select="$remainder"/></remainder>
               -->
               <!-- if we have fewer than a positive multiple of 8 rows, add empty rows -->
               <xsl:if test="$count = 0 or $remainder &gt; 0">
                    <xsl:variable name="startSeqnum">
                         <xsl:choose>
                              <xsl:when test="/COWS/COW[KEY1 = '1']/SEQNUM">
                                   <xsl:for-each select="/COWS/COW[KEY1 = '1']/SEQNUM">
                                        <xsl:if test="not(/COWS/COW[KEY1 = '1' and SEQNUM &gt; current()])">
                                             <xsl:value-of select=". + 1"/>
                                        </xsl:if>
                                   </xsl:for-each>
                              </xsl:when>
                              <xsl:otherwise>
                                   <xsl:text>1</xsl:text>
                              </xsl:otherwise>
                         </xsl:choose>
                    </xsl:variable>
                    <!-- insert as many empty rows as necessary to guarantee we have at least 8 rows and the total # of rows is a multiple of 8 -->
                    <xsl:call-template name="emptyRows">
                         <xsl:with-param name="seqnum" select="$startSeqnum"/>
                         <xsl:with-param name="endSeqnum" select="$startSeqnum + (8 - $remainder) - 1"/>
                    </xsl:call-template>
               </xsl:if>
          </CHICKENROWS>
     </xsl:template>
     <!--
          Recursively insert empty rows with seqnums starting at $seqnum and going to $endSeqnum
     -->
     <xsl:template name="emptyRows">
          <xsl:param name="seqnum"/>
          <xsl:param name="endSeqnum"/>
          <xsl:if test="$seqnum &lt;= $endSeqnum">
               <CHICKENROW seqnum= "{$seqnum}"></CHICKENROW>
               <xsl:call-template name="emptyRows">
                    <xsl:with-param name="seqnum" select="$seqnum + 1"/>
                    <xsl:with-param name="endSeqnum" select="$endSeqnum"/>
               </xsl:call-template>
          </xsl:if>
     </xsl:template>
</xsl:stylesheet>
=======================================================
INPUT XML:
=======================================================
<COWS>
     <COW>
          <KEY1>1</KEY1>
          <SEQNUM>1</SEQNUM>
          <CHICKEN>ACMI2</CHICKEN>
     </COW>
     <COW>
          <KEY1>1</KEY1>
          <SEQNUM>2</SEQNUM>
          <CHICKEN>ALTE</CHICKEN>
     </COW>
     <COW>
          <KEY1>1</KEY1>
          <SEQNUM>3</SEQNUM>
          <CHICKEN>ANRO2</CHICKEN>
     </COW>
     <COW>
          <KEY1>1</KEY1>
          <SEQNUM>4</SEQNUM>
          <CHICKEN>ARCO5</CHICKEN>
     </COW>
     <COW>
          <KEY1>1</KEY1>
          <SEQNUM>5</SEQNUM>
          <CHICKEN>ARFR4</CHICKEN>
     </COW>
     <COW>
          <KEY1>1</KEY1>
          <SEQNUM>6</SEQNUM>
          <CHICKEN>ARTRV</CHICKEN>
     </COW>
     <COW>
          <KEY1>1</KEY1>
          <SEQNUM>7</SEQNUM>
          <CHICKEN>ASMO7</CHICKEN>
     </COW>
     <COW>
          <KEY1>1</KEY1>
          <SEQNUM>8</SEQNUM>
          <CHICKEN>CAGE2</CHICKEN>
     </COW>
     <COW>
          <KEY1>1</KEY1>
          <SEQNUM>9</SEQNUM>
          <CHICKEN>COUM</CHICKEN>
     </COW>
     <COW>
          <KEY1>1</KEY1>
          <SEQNUM>10</SEQNUM>
          <CHICKEN>ERIOG</CHICKEN>
     </COW>
     <COW>
          <KEY1>1</KEY1>
          <SEQNUM>11</SEQNUM>
          <CHICKEN>FEID</CHICKEN>
     </COW>
     <COW>
          <KEY1>1</KEY1>
          <SEQNUM>12</SEQNUM>
          <CHICKEN>LEPID</CHICKEN>
     </COW>
     <COW>
          <KEY1>1</KEY1>
          <SEQNUM>13</SEQNUM>
          <CHICKEN>LEPID</CHICKEN>
     </COW>
     <COW>
          <KEY1>1</KEY1>
          <SEQNUM>14</SEQNUM>
          <CHICKEN>LEPID</CHICKEN>
     </COW>
     <COW>
          <KEY1>1</KEY1>
          <SEQNUM>15</SEQNUM>
          <CHICKEN>LEPID</CHICKEN>
     </COW>
     <COW>
          <KEY1>1</KEY1>
          <SEQNUM>16</SEQNUM>
          <CHICKEN>LEPID</CHICKEN>
     </COW>
     <COW>
          <KEY1>1</KEY1>
          <SEQNUM>17</SEQNUM>
          <CHICKEN>LEPID</CHICKEN>
     </COW>
     <COW>
          <KEY1>1</KEY1>
          <SEQNUM>18</SEQNUM>
          <CHICKEN>LEPID</CHICKEN>
     </COW>
     <COW>
          <KEY1>1</KEY1>
          <SEQNUM>19</SEQNUM>
          <CHICKEN>LEPID</CHICKEN>
     </COW>
</COWS>

... or maybe they're not bugs at all, but if they're not, they're at least a difference in implementation from MSXML and Xalan. Do I misunderstand the XPath/XSL I'm using here? Is Oracle's interpretation equally valid?

Similar Messages

  • Two XSLT maps in one senario.

    Please help me with the senario where I want ot use two XSLT maps in one XI senario. The out put of the first map will be input for the second XSLT map.
    - Rajan

    what you have to do is you have to arrange the message mappings in the interface mapping.
    I have scenraios with 4 consecutive mappings it works fine no issues with that
    Interface Mapping
    Source Msg ---  Mapping1 -
    Target Message
                           Mapping 2
                           Mapping 3

  • One of two synced fonts doesn't appear in Adobe Muse, but in Photoshop CC it does.

    One of two synced fonts doesn't appear in Adobe Muse, but in Photoshop CC it does. What can I do?
    I synced "Mostra Nova" and "Proxima Nova" with typekit. But only Mostra Nova appears in Adobe Muse. Proxima Nova doesn't. In Photoshop CC both appear. Can I fix this? Or is it a bug, that will be fixed?

    Thanks for the screenshots, Martin! 
    Do you happen to use Suitcase Fusion to manage the installed fonts on your computer?  We have recently identified a bug in the program which inteferes with fonts synced from Typekit. More information and a workaround is available here:
    http://help.typekit.com/customer/portal/articles/1323222
    If not, would you please send your recent sync logs to [email protected], so we can look into this further?
    On OS X:
    * Open the Finder
    * under the Go menu, select "Go To Folder"
    * in the windows that opens, type:  /Users/(username)/Library/Application Support/Adobe/CoreSync/
    Note that you need to replace "(username)" with your own account name; for instance, on my computer I am "galle".
    (Or if you are comfortable working from the Terminal, cd to $HOME/Library/Application Support/Adobe/CoreSync/)
    On Windows:
    C:\Users\user name\AppData\Roaming\Adobe\CoreSync\
    Attach the recent CoreSync-yyyy-MM-dd.log files to an email. Please don't send a zip file, as they often get flagged as spam.
    Thank you again,
    -- liz

  • Satellite P500 PSPG8E - Bios peeps 3 time - one long two short

    Hello,
    I have a question: when I power on my Satelite P500 PSPG8E I get 3 Peeps: One long two short!
    What is this, maybe Memory?
    Thanks allot
    Greetings from Germany
    Michael Burkhardt

    Hi Michael,
    I dont know what this beep code means exactly but as you wrote, it could be a RAM issue.
    Do you have two modules installed? If yes you should try to start your notebook with one module only and test each module in each slot to determine if its RAM, RAM socket or something else.
    But if your notebook is under warranty the repair would be for free if you contact an ASP in your country. ;)

  • My iMac locks up constantly in email. I click on one or two emails. Then when I click on another email, I get the spinning wheel and have to relaunch. Why does it get confused and lock up?

    My iMac locks up constantly in email. I click on one or two emails. Then when I click on another email, I get the spinning wheel and have to relaunch. Why does it get confused and lock up? Seems like it is stuck.

    10.6.8 here, MacBook Pro. Comcast. Mail  freeze ups. Occasional warnings to use "Log Out" under the Apple icon.
    Disk Repair run several times. Shows lots of Java  "remote" issues.
    I run Disk Repair several times, shows a lot of Java, "remote" issues.
    Restart don't know if it helps, I do it all the time. What's with quitting Mail but it doesn't quit, and why a separate maneuver to "Log Out".
    i

  • When I open iTunes it is slow to open for one, and two when it does see my iPhone and i go to sync it this is what I get in return... The iPhone "My Name here" could not be synced because the iPhone could not be found on the network. that is a pop up box

    When I open iTunes it is slow to open for one, and two when it does see my iPhone and i go to sync it this is what I get in return... The iPhone "My Name here" could not be synced because the iPhone could not be found on the network. that is a pop up box in middle of screen that says that it does it like every time I go to sync the phone after i do app updates. I am getting very frustrated by this can someone please help. I have made 2 other discussion topics about this and no replies on them. Please if anyone can help I ask for help. This has occurred ever since the iOS 5.1 update and the iTunes 10.6.0 and still continues with the iTunes 10.6.1 update just yesterday and perhaps even worse now. PLEASE HELP IF YOU CAN. I have looked through my network settings etc and everything looks good here on my side.

    When I open iTunes it is slow to open for one, and two when it does see my iPhone and i go to sync it this is what I get in return... The iPhone "My Name here" could not be synced because the iPhone could not be found on the network. that is a pop up box in middle of screen that says that it does it like every time I go to sync the phone after i do app updates. I am getting very frustrated by this can someone please help. I have made 2 other discussion topics about this and no replies on them. Please if anyone can help I ask for help. This has occurred ever since the iOS 5.1 update and the iTunes 10.6.0 and still continues with the iTunes 10.6.1 update just yesterday and perhaps even worse now. PLEASE HELP IF YOU CAN. I have looked through my network settings etc and everything looks good here on my side.

  • One computer, two itunes libraries, ?one authorization

    I plan to buy a new iMac and will set up two user accounts on the one device. If each account has their own iTunes library, will that require one or two authorizations. I am concerned because I did not have a chance to deauthorize my other machines. Thank you for the information.

    An authorization is for an iTunes store account.
    If you have 2 (or more) user accounts on your computer and they all have individual libraries and all are authorized to use the one iTunes account, you will only have used one iTunes authorization.
    One machine uses one authorization, regardless of number of user accounts.

  • I apparently have more than one Apple ID.  So, 1) how do I find out how many different ones exist, and 2) how can I consolidate them into one or two?

    I have inadvertenly created two or more different Apple IDs.  How can I learn all the different IDs associated with my email accounts or my name?  How can I consolidate the different IDs into one or two?

    Go to https://iforgot.apple.com/ and click the blue link "Forgot your Apple ID?"
    It will result a page in which you can provide some contact information that may possibly find an existing Apple ID.
    How can I consolidate the different IDs into one or two?
    This cannot be accomplished.

  • How do I create a pdf from just one or two pages of an existing pdf?

    I just purchased this product (acrobat online)
    and it is not allowing me to do the things it promised, e.g. saving portions of one pdf to another, combining pages or entire docuements to create, even typing into a document (editing)! I am so frustrated - can someone please help!?

    But I jut paid $89.00 for the adobe pack - if I subscribe to Acrobat Plus, will that be credited?
    Date: Thu, 19 Sep 2013 15:50:14 -0700
    From: [email protected]
    To: [email protected]
    Subject: Files.Acrobat.com How do I create a pdf from just one or two pages of an existing pdf?
        Re: How do I create a pdf from just one or two pages of an existing pdf?
        created by H.Spector in Files.Acrobat.com - View the full discussion
    Hi,
    Thank you for your subscription.  If you are Acrobat Plus subscriber then you can extract the pages from the PDF file using Tools> Pages> Extract pages.
    You can find "Tools" at right top once you open your PDF file in Acroat.
    If you are subscriber to PDF Pack then please download Acrobat XI Plus from www.adobe.com.
    PDF Pack service offers "Convert to PDF", "Export from PDF"(to Word/PowerPoint/Excel/RTF formats so that you can edit the exported files) and "Combine Files" (combine your files into a single PDF file).
    Please let me know if you have any quesitons.
    thank you.
    hisami
         Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at http://forums.adobe.com/message/5697921#5697921
         Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/5697921#5697921
         To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/5697921#5697921. In the Actions box on the right, click the Stop Email Notifications link.
         Start a new discussion in Files.Acrobat.com by email or at Adobe Community
      For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

  • A friend set me up with icloud and in the process he lost some of the book i was listening to. I can't find it in my ipod or on my computer. It is part one and two of a book; interest part three showed up hough.

    A friend set me up with icloud on my ipod touch and in the process lost part one and two of the book I had purchased from itunes. I searched for it and it is not in my ipod any longer, although part 3 is there.  I tried to download it again from itunes store but they said I already purchased it and I didn't want to be charged again. What can I do? I am not happy at all because all I did with my Ipod was listen to my book and now I can't.

    Hi.
    If you've bought it from iTunes, you should be able to re-download it for free.
    Download directly from iPod by going to the iTunes Store-App and find the "Purchased"-menu. From here you should get a complete list of all your bought items and the ability to re-download.
    Download from iTunes on PC/Mac by opening iTunes > Go to iTunes Store > Go to the menubar on the left and choose "Purchased". Now, from the appearing window select the proper categori on top of the screen.
    I hope this was helpful.

  • Issue Printing One or Two Checks on HP LaserJet Pro 200 MFP M276nw

    I just purchased an HP LaserJet Pro 200 MFP M276nw which replaces an HP Color LaserJet 2605dn.
    I've run into an issue printing checkes from Quicken when I print less than a full sheet (one or two) checks.
    With my old printer, I used the manual feed for a partial sheet.
    Since the new printer does not have a manual feed, I have to put the partial sheet in the paper tray.
    It seems one of two things happen:
    1) Sometimes the printer will print the partial page but then displays an error message which says something like "Unexpected paper size, load letter."
    It then re-prints the partial page on the next sheet of paper.
    2) Othertimes, it prints the partial page without the error message, but then feeds the next sheet of paper throught the printer.
    In either case the next page contains the next three checks, so it's either wasting checks or printing on the wrong check numbers.
    Any suggestions on how to avoid these issues would be appreciated.

    Me too.
    I've been using an alternate printer for printing the checks, but I'd rather get rid of the old one. (The HP Laser Pro 200 takes up a lot of space!)
    KC, Seems like you've been waiting for an answer for a VERY long time.  I'm not going to hold my breath.
    Hey HP!  Do you ever monitor this site?!
    KC-Texas wrote:
    I just purchased an HP LaserJet Pro 200 MFP M276nw which replaces an HP Color LaserJet 2605dn.
    I've run into an issue printing checkes from Quicken when I print less than a full sheet (one or two) checks.
    With my old printer, I used the manual feed for a partial sheet.
    Since the new printer does not have a manual feed, I have to put the partial sheet in the paper tray.
    It seems one of two things happen:
    1) Sometimes the printer will print the partial page but then displays an error message which says something like "Unexpected paper size, load letter."
    It then re-prints the partial page on the next sheet of paper.
    2) Othertimes, it prints the partial page without the error message, but then feeds the next sheet of paper throught the printer.
    In either case the next page contains the next three checks, so it's either wasting checks or printing on the wrong check numbers.
    Any suggestions on how to avoid these issues would be appreciated.

  • Can only import one or two songs at a time from a cd into itunes

    Please help. I had a new hard drive put into my imac flat panel g4. When I try to import music from a cd into itunes it closes or freezes itunes after one or two songs have been imported.

    hmmmm. do you have any other USB 2.0 peripherals plugged in to the PC?
    if so, try (experimentally) disconnecting them prior to a sync. (sometimes power drain through one port can affect an ipod connection on a different port.)
    any improvement in sync performance if you try that?
    love, b

  • HT201177 My mac os frequently freezes for one to two minutes at a time. I have uninstalled and reinstalled flashplayer 11.3 several times because I sometimes get a crash report on flashplayer. I would like other suggestions as to what I can do.and re

    My mac os frequently freezes for one to two minutes at a time. I have uninstalled and reinstalled flashplayer 11.3 several times because I sometimes get a crash report on flashplayer. I would like other suggestions as to what more I can do.

    The next time you have the problem, note the exact times when it starts and ends: hour, minute, second.
    If you have more than one user account, these instructions must be carried out as an administrator.
    Launch the Console application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ If you’re running Mac OS X 10.7 or later, open LaunchPad. Click Utilities, then Console in the page that opens.
    Make sure the title of the Console window is All Messages. If it isn't, select All Messages from the SYSTEM LOG QUERIES menu on the left.
    Scroll back in the log to the time you noted above. Post any messages timestamped during that interval – the text, please, not a screenshot.
    Important: Some private information, such as your name, may appear in the log. Edit it out by search-and-replace in a text editor before posting.

  • I used to be able to download a lot of cd's, now I cannot download more than one or two cd's at a time. I am told that my 'cache' is full and I need to re-start iTunes to clear some of the 'cache' memory. What is the cache and how do I resolve this?

    CD download problems:
    I used to be able to download numerous cd's at a time but now I can only do one or two until I restart iTunes. I have been told that my 'cache' is full and will only empty a little a each restart. I did look at the properties and the 'cache' is showing full How do I correct or improve
    this?

    Final Cut is a separate, higher end video editor.  The pro version of iMovie.
    Give iPhoto a look at for creating the slideshow.  It's easy to assemble the photos in an album in iPhoto, put them in the order you want and then make a slideshow of them.  You can select from various themes and transitions between slides and add music from your iTunes library.
    When you have the slidshow as you want use the Export button at the bottom of the iPhoto window and export with Size = Medium or Large.
    Save the resulting Quicktime movie file in your Movies folder.
    Next, open iDVD, choose your theme and drag the QT movie file into the menu window being careful to avoid any drop zones.
    Then follow this workflow to help assure the best qualty video DVD:
    Once you have the project as you want it save it as a disk image via the File ➙ Save as Disk Image  menu option. This will separate the encoding process from the burn process. 
    To check the encoding mount the disk image, launch DVD Player and play it.  If it plays OK with DVD Player the encoding is good.
    Then burn to disk with Disk Utility or Toast at the slowest speed available (2x-4x) to assure the best burn quality.  Always use top quality media:  Verbatim, Maxell or Taiyo Yuden DVD-R are the most recommended in these forums.
    The reason I suggest iPhoto is that I find it much easier to use than iMovie (except for the older iMovie 6 HD version).  Personal preferences showing here.

  • Is there a way to prevent ibooks author from shutting down after just one or two uses of the alpha tool?

    Is there a way to prevent ibooks author from shutting down after just one or two uses of the alpha tool?

    Hello One Job at a time,
    Deleting the application will not delete your projects.
    Normally I keep all my work files on a separate drive.
    If you command click on the title name of your project you will get a drop down path to show you the location of your book project.
    or you can click on the drop down triangle beside its name to duplicate.
    Just remember where you saved the file too.
    In your applications folder on your computer select the iBA icon and press delete and also erase / empty the trash can.
    You can then go back to the APP STORE and install iBA from new again.
    I hope this helps.
    Regards,
    Nigel

Maybe you are looking for