Wrong XSLT in upgrade.xsl? - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Wrong XSLT in upgrade.xsl?

Last post 11-16-2010 05:22 AM by Patrick Halstead. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 11-16-2010 05:13 AM

    Wrong XSLT in upgrade.xsl?

    Good Morning, 

    I have an InfoPath 2007 form (browser based) that presents application error messages to the user by showing/hiding expression boxes.  Recently I had need to update the text in one of the error messages.  My problem is that while the changed error message text appears in any new forms created by the user, the old error message text is shown when the user accesses an existing form.  My understanding of InfoPath tells me that this sort of situation is managed by the upgrade.xsl file that is bundled in the xsn.  So I opened up the upgrade.xsl and did some investigating. 

    Here's my original error message text:

    cert2_actemra_recentuse_text = "The Most Recent Use Date must be a valid date."

    Here's what I changed it to:

    cert2_actemra_recentuse_text = "The Most Recent Use Date must be a valid date that is not in the future."

    Here's the XSLT code that was generated in upgrade.xsl:

    <xsl:element name="my:cert2_actemra_recentuse_text">
         <xsl:choose>
              <xsl:when test="my:cert2_actemra_recentuse_text">
                   <xsl:copy-of select="my:cert2_actemra_recentuse_text/text()[1]"/>
              </xsl:when>
              <xsl:otherwise>The Most Recent Use Date must be a valid date that is not in the future.</xsl:otherwise>
         </xsl:choose>
    </xsl:element>

    Now I don't pretend to be an expert in XSLT so I ran it through the XSLT debugger in Visual Studio (2008) using XML from an existing form as input.  I expected the code to branch to the "otherwise" and use the error message text contained therein.  However, that is not the case - it executes the "copy-of" statement and then proceeds to the next element.  The end result is that I get the original error message text instead of the new error message text.

    THE XSLT appears to say:  "if you find an element named 'cert2_actemra_recentuse_text' then use its value, otherwise use "The Most Recent Use Date must be a valid date that is not in the future.".  In effect, it appears that InfoPath is generating the wrong XSLT for the given situation.  The XSLT should be configured so that it unconditionally replaces the value of cert2_actemra_recentuse_text with the new value.

    I expect the workaround here will be to delete the error message entirely and create another with a slightly different name that has the correct error message text in it. 

    Any takers on why this might have happened and how I might avoid it in the future?

    Thanks in advance for any feedback.

    \cbf

  • 11-16-2010 05:22 AM In reply to

    Re: Wrong XSLT in upgrade.xsl?

    Hi CFernald,

    Nice post! I don't know, but it's easy to edit the upgrade,xsl right? My guess is that the upgrade.xsl is trying to provide an automatic upgrade path to your form. Maybe the field changed in a significant way. I'm not sure. But, the workaround is simple. Save Source Files, open the upgrade.xsl and modify it. Edit hte manifest.xsf and republish. Not too hard.

    Good catch though. If it were more severe, I'd suggest we complain to Microsoft. :)

    Happy trails,

    Patrick Halstead
    Project Manager at Qdabra
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.