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

RE: xsl:copy-of O.K. on RTF, but nothing on <EMPTY/> e

Subject: RE: xsl:copy-of O.K. on RTF, but nothing on <EMPTY/> element content (?)
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Thu, 1 May 2003 19:00:33 +0100
hdr logo
I would suggest replacing:

   <xsl:variable name="msg-fill-contents">
      <xsl:for-each select="document($lookupfilename)//msgs/msg">
      <xsl:apply-templates 
 
select="self::node()[@name=$msg-name]/segment[@name=$segment]/markup/nod
e()"/>
      </xsl:for-each>
   </xsl:variable>
<!-- +++++++++++++++++++++++++++++++++++++++++++++++
QUESTION HERE: WHAT TEST WILL CATCH THAT WE HAVE "BROKEN" LOOKUP DATA?
      +++++++++++++++++++++++++++++++++++++++++++++++ -->
<!-- +++ "Nodeset Presence" test: NOT working. +++  -->
   <xsl:when test="$msg-fill-contents">
      <xsl:copy-of select="$msg-fill-contents"/>
   </xsl:when>
   <xsl:otherwise>
      <xsl:text>WARNING: $msg-fill-contents lookup came back EMPTY,
apparently.</xsl:text>   
   </xsl:otherwise>

with:

<xsl:variable name="messages" 
  select="document($lookupfilename)//msgs/
 
msg[@name=$msg-name]/segment[@name=$segment]/markup/node()"/>

<xsl:choose>
<xsl:when test="$messages">
  <xsl:apply-templates select="$messages"/>
<xsl:when>
<xsl:otherwise>
  <xsl:text>WARNING: $msg-fill-contents lookup came back EMPTY,
apparently.</xsl:text>   
</xsl:otherwise>


Michael Kay

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> William Reilly
> Sent: 01 May 2003 17:17
> To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE:  xsl:copy-of O.K. on RTF, but nothing on 
> <EMPTY/> element content (?)
> 
> 
> Greetings.
> 
> This is a long posting, and is follow-up to my question of a 
> week back.
> 
> Below, I have words of thanks for those who ventured a response; 
> a mini-Table-Of-Contents for this posting (!); the pasted in 
> full code 
> (4 files); an entire "Results Matrix"; and a set of URL links to the 
> earlier XSL-List postings.
> 
> There is a "Question" in here (near the top!), the answer to 
> which may be:
> - one of those one-liners I can never think of (à la empty 
> nodeset is select='/..'),
> - a simple admonition, "Don't Do It That Way",
> - or maybe something that'll help me better understand RTFs, 
> nodesets, and 
>    testing for "empty" results.
> 
> Or, of course, may be something else entirely... :>)
> 
> Many Thanks,
> William Reilly
> wreilly@xxxxxxxxxxx
> Boston, Massachusetts U.S.A.
> 
> ===  Briefest Possible (!?) Summary  =======================
> 1.) First, no great surprise, I was in the wrong re: my 
> original question. 
>     I had the _wrong_ xsl:when test (!!)  (details below).
>     So, that part I now understand. Lesson Learned. Good.
> 
> 2.) *However*, while working on all this, I have come upon a new 
>     (closely related) question: 
> 
>  >>> Q. "What is the correct test to catch the following data 
> error (empty/no results)?"  <<<
> 
>    [ Attempt at pre-emptive guess: I think I may have some sort of 
>    "impedance mismatch" (?), as I am trying to test a 
> variable built up 
>    as an RTF, but using a test I call "nodeset presence" 
>    (<xsl:when test="$msg-fill-contents">).  It's not working; 
>    and I don't know what test would work. 
>    *(Please see also "Important Testing Note" ~50 lines below) ]
> 
>   [ If the simple answer is: "Don't Do That" (impedance 
> stuff), then that's fine.  
>      I _do_ now have another solution that _does_ work 
> (nodesets, instead of RTF).
>      I'm just seeking to understand this puzzle a little 
> better... :>} ]
> 
> maindatafile.xml
> ----------------
> <main-msg name="hdr-logo"/>
> 
> lookupfile.xml
> ----------------
> <msg name="hdr-logo">
>    <segment name="CALIFORNIA_BROKEN-WRONG-LOOKUP-DATA">
>       <markup>
>          <img src="california.gif"/> 
>       </markup>
>    </segment>
> </msg>
> 
> lookup-msginfo_2-html.xslt
> --------------------------
> <xsl:variable name="segment" select="'CALIFORNIA'"/>
> <xsl:template match="main-msg">
> <xsl:variable name="msg-name" select="@name"/>
>    <!--  ++++++++++++++++++++++++++++++++++++++++++++++
>          Yes, this is the RTF way to build the variable. 
>          Yes, I know 'select' nodeset way is better. 
>          Bear with me a moment. :>) 
>          ++++++++++++++++++++++++++++  -->
>    <xsl:variable name="msg-fill-contents">
>       <xsl:for-each select="document($lookupfilename)//msgs/msg">
>       <xsl:apply-templates 
>          
> select="self::node()[@name=$msg-name]/segment[@name=$segment]/
> markup/node()"/>
>       </xsl:for-each>
>    </xsl:variable>
> <!-- +++++++++++++++++++++++++++++++++++++++++++++++
> QUESTION HERE: WHAT TEST WILL CATCH THAT WE HAVE "BROKEN" LOOKUP DATA?
>       +++++++++++++++++++++++++++++++++++++++++++++++ -->
> <!-- +++ "Nodeset Presence" test: NOT working. +++  -->
>    <xsl:when test="$msg-fill-contents">
>       <xsl:copy-of select="$msg-fill-contents"/>
>    </xsl:when>
>    <xsl:otherwise>
>       <xsl:text>WARNING: $msg-fill-contents lookup came back 
> EMPTY, apparently.</xsl:text>   
>    </xsl:otherwise>
> </xsl:template>
> 
> ++++++++++++++++++++++++++++++++++++++++++++++++++
> *Important Testing Note:
> This alternative test ("Empty Text") WILL catch the stated 
> problem (hooray), 
> <!-- +++ "Empty Text" test:   
>    <xsl:when test="not($msg-fill-contents='')"> +++  -->
> 
> ***BUT*** this same test is **NOT** then good for the _other_ 
> data problem you 
> might encounter (boo), namely the one I _originally_ wrote in about: 
>    <markup><img src="california.gif"/></markup> 
> or what I term "Empty Element Only Content (NO Whitespace)". 
> This second test FAILS on that (aarghh).  
> 
> >>  So, what I'm _REALLY_ looking for is the test that'll do _BOTH_ 
>     (if I can find one!). <<
> 
> [Why? you might ask. 
> I guess I'd have to say this falls into the "I'd just like to 
> find out" category.]
> 
> [ By the way, yes I'm testing on recent 
>    Xalan (j2sdk1.4.1_01) and Saxon (Instant 6.5.2) ]
> ++++++++++++++++++++++++++++++++++++++++++++++++++
> 
> Output Results 
> (did not work right! did not catch the data error! (by my 
> test, anyway))
> ------------------------------------
> This is what (below, in Results Matrix) I call "FAIL CASE #2"
> I. B. 2. a. = RTF variable | Nodeset test | BROKEN Lookup | WITHSpace
> SHOULD NOT GO THROUGH!!   **TEST FAILS**  
> It does *Not* get caught (by my test, anyway)! Bad.
> 
> (As you can see in the debug output's "$msg-fill-contents copy-of", 
>  there is nothing in there (?). So why doesn't the test catch that?  
>  Must be some lingering node in there, or some such??...)
> 
> DEBUG: WE ARE INSIDE xsl:when test="$msg-fill-contents" was 
> TRUE, apparently.
> $MSG-NAME:  [hdr-logo] 
> $MSG-FILL-CONTENTS VALUE-OF:  [] 
> $MSG-FILL-CONTENTS COPY-OF:  []
> 
> === /End of Briefest Possible (!?) Summary 
> ==============================
> 
> 
> 
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> +++++++++++++++++
> TABLE OF CONTENTS (!)
> 1. Intro, explanation
> 2. 4 Code Files: XML data file; XML lookup file; XSLT; HTML.
> 3. Results Matrix (four-level hierarchy of test permutations)
> 4. "Bibliography" (!) of URL links to related earlier 
> XSL-List postings
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> +++++++++++++++++
> 
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> +++++++++++++++++
>    INTRO, EXPLANATION
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> +++++++++++++++++
> 
> This posting contains all info for the original question:
> William Reilly 2nd e-mail [Wed, 23 Apr 2003 17:30:01 -0400]
> Subj: RE:  xsl:copy-of O.K. on RTF, but nothing on 
> <EMPTY/> element content (?)
> http://www.biglist.com/lists/xsl-list/archives/200304/msg01138.html
> 
> That original question is now resolved, as I had the wrong 
> xsl:when test!
> 
> I do want to thank Wendell Piez (twice!) and Michael Kay for 
> responding to my 
> rather odd, almost off-putting & bald-faced query:
> +++++++++++++++++++++++++++++++++++++++++++
> CODE #1:<markup> <img src="pic.gif"/></markup>
> +++++++++++++++++++++++++++++++++++++++++++
> +++++++++++++++++++++++++++++++++++++++++++
> CODE #2:<markup><img src="pic.gif"/></markup>
> ++++++++++++++++++++++++++++++++++++++++++
> asking why a single space character difference was causing me 
> (I thought) 
> erroneous output.  Fact is, I was testing it erroneously.  
> Lesson Learned: If you're going to test, make sure you're running 
> the right test (!).
> <!-- FLAWED   TEST         <xsl:when 
> test="not($msg-fill-contents='')">  -->
> <!-- CORRECT TEST -->   <xsl:when test="$msg-fill-contents"> 
> 
> I also want to say thanks for the "code tightening" advice. 
> Very useful 
> instruction, and helpful; I now have improved XPath, and a nodeset, 
> no longer RTF.
> 
> Finally, thanks to many recently writing in for a lot of good 
> learning on 
> RTF vs. nodesets generally.
> 
> 
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> +++++++++++++++++
>       CODE: 4 FILES   (XML data file; XML lookup file; XSLT; 
> HTML output)
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> ++++++++++++++++
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> +++++++++++++++++
>    1.   MAINDATAFILE.XML
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> +++++++++++++++++
> === maindatafile.xml 
> =====================================================
> <?xml version="1.0" encoding="UTF-8"?>
> <!-- maindatafile.xml 
>    Author: William Reilly, wreilly@xxxxxxxxxxx  
>    May 1, 2003 -->
> <main>
>    <div id="td01">
>       <main-msg name="hdr-logo"/>
>    </div>
>    <div id="td02">
>       <main-msg name="hdr-nav"/>
>    </div>
>    <div id="body">
>    <p>As an Acme Bank <main-msg 
> name="which-checking-account"/> checking customer, 
>    you may want to consider <main-msg 
> name="which-maximizer-product"/>.</p>
>    </div>
> </main>
> === /maindatafile.xml 
> =====================================================
> 
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> +++++++++++++++++
>    2.   LOOKUPFILE.XML
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> +++++++++++++++++
> ===  lookupfile.xml  
> ========================================================
> <?xml version="1.0" encoding="UTF-8"?>
> <!-- lookupfile.xml 
>    Author: William Reilly, wreilly@xxxxxxxxxxx  
>    May 1, 2003 -->
> <msgs>
>    <msg name="hdr-logo">
> <!-- THREE VARIATIONS ON ONE <SEGMENT> INSTANCE: -->
> <!-- Lookup "Correct"; WITHSpace -->
>       <segment name="CALIFORNIA">
>          <markup> <img src="acmebank.gif" alt="Acme Bank"/></markup>
>       </segment>
> <!-- Lookup "Correct"; WITHOUTSpace 
>       <segment name="CALIFORNIA">
>          <markup><img src="acmebank.gif" alt="Acme Bank"/></markup>
>       </segment>
> -->
> <!-- Lookup "Broken"; (WITHSpace or WITHOUTSpace same results) 
>       <segment 
> name="CALIFORNIA_BROKEN-LOOKUP-SEGMENT-NAME_SHOULD-NOT-WORK">
>          <markup><img src="acmebank.gif" alt="Acme Bank"/></markup>
>       </segment>
> -->
> <!--  /End - THREE VARIATIONS ON ONE <SEGMENT> INSTANCE: -->
> 
> <!-- other segments... -->
>       <segment name="OREGON">
>          <markup>
>             <img src="acmebank.gif" alt="Acme Bank"/>
>          </markup>
>       </segment>
>    </msg>
>    <msg name="hdr-nav">
>       <segment name="CALIFORNIA">
>          <markup>
>             <img src="california-nav.gif" alt="Find It 
> (California) Navigation"/>
>          </markup>
>       </segment>
>       <segment name="OREGON">
>          <markup>
>             <img src="oregon-nav.gif" alt="Contact Us 
> (Oregon) Navigation"/>
>          </markup>
>       </segment>
>    </msg>
>    <msg name="which-checking-account">
>       <segment name="CALIFORNIA">
>          <markup>
>             <b>PremiumGold</b>
>          </markup>
>       </segment>
>       <segment name="OREGON">
>          <markup>
>             <b>AdvantageGreen</b>
>          </markup>
>       </segment>
>    </msg>
>    <msg name="which-maximizer-product">
>       <segment name="CALIFORNIA">
>          <markup>an <a 
> href="http://www.acmebank.com/interest-max.html">Interest 
> Maximizer account</a>.</markup>
>       </segment>
>       <segment name="OREGON">
>          <markup>a <a 
> href="http://www.acmebank.com/money-max.html">Money Maximizer 
> account</a>, free of the monthly maintenance fee.*</markup>
>       </segment>
>    </msg>
> </msgs>
> ===  /lookupfile.xml  
> ========================================================
> 
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> +++++++++++++++++
>    3.   LOOKUP-MSGINFO_2-HTML.XSLT
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> +++++++++++++++++
> ===  lookup-msginfo_2-html.xslt  
> ===============================================
> <?xml version="1.0" encoding="UTF-8"?>
> <!-- lookup-msginfo_2-html.xslt 
>    Author: William Reilly, wreilly@xxxxxxxxxxx  
>    May 1, 2003 
>    
>    One Stylesheet with matrix of Four Combinations (comment 
> out as appropriate):
>    - Variable either RTF 'build up' or Nodeset 'select'
>       - then, "xsl:when test" either "Empty Text" or "Nodeset 
> Presence" 
>    (Currently: RTF 'build up' + "Nodeset Presence" test.)
>    -->
> <xsl:stylesheet version="1.0" 
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>    <xsl:output method="html"/>
> <!-- Would normally be params, not 'hard-coded' variables. 
> (Note these are 'text strings'!) -->
>    <xsl:variable name="lookupfilename" select="'lookupfile.xml'"/>
>    <xsl:variable name="segment" select="'CALIFORNIA'"/>
>    <xsl:variable name="debugging" select="'true'"/>  
> <!--   <xsl:variable name="debugging" select="'false'"/> --> 
>    <xsl:template match="/">
>       <html>
>          <head/>
>          <body>
>             <xsl:apply-templates/>
>          </body>
>       </html>
>    </xsl:template>
>    <xsl:template match="main">
>       <table border="0" cellpadding="0" cellspacing="0" width="560">
>          <tr>
>             <td>
>                <xsl:apply-templates select="div[@id='td01']"/>
>             </td>
>             <td>
>                <xsl:apply-templates select="div[@id='td02']"/>
>             </td>
>          </tr>
>       </table>
>       <div>
>          <xsl:apply-templates select="div[@id='body']"/>
>       </div>
>    </xsl:template>
>    <xsl:template match="b">
>       <span style="font-weight:bold; ">
>          <xsl:apply-templates/>
>       </span>
>    </xsl:template>
>    <xsl:template match="p">
>       <p style="padding-left:20; ">
>          <xsl:apply-templates/>
>       </p>
>    </xsl:template>
>    <xsl:template match="img">
>       <xsl:element name="img">
>          <xsl:copy-of select="@*"/>
>       </xsl:element>
>    </xsl:template>
> 
>    <!-- NODESET 'SELECT' APPROACH TO CREATING VARIABLE. 
>     STEP 1.
>     [!== W. Piez: "Binds the set of msg nodes to the 
> variable, once, globally ==]
>     <xsl:variable name="messages" 
> select="document($basedir_span-fillLookupFilenameExt)//msgs/msg"/> 
>    -->
>    <xsl:template match="main-msg">
>       <xsl:variable name="msg-name" select="@name"/>
>       <!-- NODESET 'SELECT' APPROACH TO CREATING VARIABLE. 
>        STEP 2.
>        [!== W. Piez "tightened up code..."   ==]   
>        <xsl:variable name="msg-fill-contents" 
> select="$messages[@name=$msg-name]/segment[@name=$segment]/markup"/>  
>       -->
>       <!-- RTREEFRAG 'BUILD UP' APPROACH TO CREATING VARIABLE.  -->
>       <xsl:variable name="msg-fill-contents">
>          <xsl:for-each select="document($lookupfilename)//msgs/msg">
>             <xsl:apply-templates 
> select="self::node()[@name=$msg-name]/segment[@name=$segment]/
> markup/node()"/>
>          </xsl:for-each>
>       </xsl:variable>
>       
>       <xsl:choose>
>          <!-- +++++++    TEST # 1  ++++++++++++++++++++++++++ -->
>          <!-- "EMPTY-TEXT" MODE OF TESTING.  
>           <xsl:when test="not($msg-fill-contents='')">  
>             <xsl:if test="$debugging='true'">
>               <xsl:text>DEBUG: WE ARE INSIDE xsl:when 
> test="not($msg-fill-contents='')" was TRUE, apparently.</xsl:text>
>               <xsl:text>$MSG-NAME: </xsl:text> [<xsl:value-of 
> select="$msg-name"/>] 
>               <xsl:text>$MSG-FILL-CONTENTS VALUE-OF: 
> </xsl:text> [<xsl:value-of select="$msg-fill-contents"/>] 
>               <xsl:text>$MSG-FILL-CONTENTS COPY-OF: 
> </xsl:text> [<xsl:copy-of select="$msg-fill-contents"/>]   
>             </xsl:if> -->
> <!-- Comments:   Succeeds WITHSpace,    but Fails WITHOUTSpace.
>    Note: Yes, by the way, this test WILL work correctly if 
> the Lookup file is "Broken,"
>    that is, when there is NOT a match on 'segment' or on 'msg'.
>    (See discussion at Test # 2 below)
> -->
>          <!-- +++++++    TEST # 2  ++++++++++++++++++++++++++ -->
>          <!-- "NODESET-PRESENCE" MODE OF TESTING. -->
>          <xsl:when test="$msg-fill-contents">
>             <xsl:if test="$debugging='true'">
>                <xsl:text>DEBUG: WE ARE INSIDE xsl:when 
> test="$msg-fill-contents" was TRUE, apparently.</xsl:text>
>                <xsl:text>$MSG-NAME: </xsl:text> 
> [<xsl:value-of select="$msg-name"/>] 
>                <xsl:text>$MSG-FILL-CONTENTS VALUE-OF: 
> </xsl:text> [<xsl:value-of select="$msg-fill-contents"/>] 
>                <xsl:text>$MSG-FILL-CONTENTS COPY-OF: 
> </xsl:text> [<xsl:copy-of select="$msg-fill-contents"/>]   
>             </xsl:if> 
> 
> <!-- Comments:    Succeeds BOTH WITHSpace and WITHOUTSpace. 
> Good, but...
> 
>    ******    HOWEVER!  ***********
>    This test was NOT catching when the Lookup File is "Broken."  (!)
>    That is, when there is NOT a match on 'segment' or on 'msg'.
>    [ Please Note: No, in theory this "broken" situation 
> should not occur.
>    BUT, it could, and it's the most critical situation to 
> guard against (!),
>    namely: the Main and Lookup files getting out of synch. ]
> -->
>             <span style="background-color:#D2E9FF; ">
>                <xsl:copy-of select="$msg-fill-contents"/>
>                <!--  <xsl:apply-templates 
> select="$msg-fill-contents"/>  -->
>             </span>
>          </xsl:when>
>          <xsl:otherwise>
>             <xsl:if test="$debugging='true'">
> <!-- TEST # 1 <xsl:text>DEBUG: XSL:OTHERWISE xsl:when 
> test="not($msg-fill-contents='')" was FALSE, 
> apparently.</xsl:text> -->
> <!-- TEST # 2 --> <xsl:text>DEBUG: XSL:OTHERWISE xsl:when 
> test="$msg-fill-contents" was FALSE, apparently.</xsl:text>  
>               <xsl:text>$MSG-NAME: </xsl:text> [<xsl:value-of 
> select="$msg-name"/>] 
>               <xsl:text>$MSG-FILL-CONTENTS VALUE-OF: 
> </xsl:text> [<xsl:value-of select="$msg-fill-contents"/>] 
>               <xsl:text>$MSG-FILL-CONTENTS COPY-OF: 
> </xsl:text> [<xsl:copy-of select="$msg-fill-contents"/>]
>             </xsl:if>
>             <xsl:text>WARNING: $msg-fill-contents lookup came 
> back EMPTY, apparently.</xsl:text>
>             <xsl:message>WARNING: $msg-fill-contents lookup 
> came back EMPTY, apparently.</xsl:message>
>                 </xsl:otherwise>
>       </xsl:choose>
>    </xsl:template>
> </xsl:stylesheet>
> ===  /lookup-msginfo_2-html.xslt  
> =========================================
> 
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> +++++++++++++++++
>    4.   (output) 
> RTF_NODE-TEST_BROKENLOOKUP_WITHSPACE_XALAN_DEBUGOFF.HTML
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> +++++++++++++++++
> === rtf_node-test_brokenlookup_withspace_XALAN_debugoff.html  
> =================
> <html>
> <head>
> <!-- rtf_node-test_brokenlookup_withspace_XALAN_debugoff.html
>    
>    Author: William Reilly, wreilly@xxxxxxxxxxx  
>    May 1, 2003 
> 
>    FAIL CASE #2   (THIS IS THE MOST INTERESTING "FAIL". WHY 
> DOES IT FAIL?)
>    I. B. 2. a. = RTF | Nodeset | BROKEN Lookup | WITHSpace
> -->
> 
> <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
> </head>
> <body>
> <table width="560" cellspacing="0" cellpadding="0" border="0">
> <tr>
> <!-- NOTE: THIS *COMMENTED-OUT* <TD> (pasted in from 
> _*another*_ run's 
>       output) IS HOW A _CORRECT_ TEST WOULD REPORT ON 
> "BROKEN" LOOKUP.  
>       Good. "OK"
>    <td>
>       WARNING: $msg-fill-contents lookup came back EMPTY, apparently.
>    </td>
> -->
> <td> <!-- WHEREAS _THIS_ <TD> (from _this_ run) _MISSES_ THE 
> PROBLEM AND 
>          FAILS TO REPORT IT. Bad. "FAIL"-->
>       <span style="background-color:#D2E9FF; "></span>
>    </td><td>
>       <span style="background-color:#D2E9FF; ">
>             <img src="california-nav.gif" alt="Find It 
> (California) Navigation">
>          </span>
>    </td>
> </tr>
> </table>
> <div>
>    
> <p style="padding-left:20; ">As an Acme Bank <span 
> style="background-color:#D2E9FF; ">
>             <span style="font-weight:bold; ">PremiumGold</span>
>          </span> checking customer, 
>   you may want to consider <span 
> style="background-color:#D2E9FF; ">an Interest Maximizer 
> account.</span>.</p>
>    
> </div>
> </body>
> </html>
> 
> === /rtf_node-test_brokenlookup_withspace_XALAN_debugoff.html 
> =================
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> ++++++++++++++++
>    /END of CODE 
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> ++++++++++++++++
> 
> 
> 
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> +++++++++++++++++
>       RESULTS MATRIX
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> +++++++++++++++++
> 
> ******************* !!PLEASE!! NOTE 
> ****************************************
> - The "OK" or "FAIL" used here below mean: *** "Did The Test 
> Do The Right Thing" ***.
>    That is, it either 
>    - "OK" = correctly caught a problem, or correctly let 
> through O.K. data. Good. "OK"
>         or, it: 
>    - "FAIL" = incorrectly let through a problem, or 
> incorrectly prevented 
>    O.K. data from going through. Bad. "FAIL"
>       
> - These "OK" and "FAIL" are *** NOT *** to be interpreted as 
>    - "The xsl:when test returned boolean true" (or false).   NO.
>    - "The transformation ran to successful completion" (or not).  NO.
> 
> They mean whether or not the test "did the right thing."
> **************************************************************
> ************
> 
> Three things to note >>>>>>>>>:
> I. A. 1. b. -was the original problem I first reported; now 
> understood.
> I. B. 2. a. -is the "most interesting" FAIL: I'd like to learn the 
>                proper 'test' for it.
> II. B. (1. b.) -is obviously the best solution: 'select' a 
> nodeset variable; 
>              then test for "nodeset presence."
> ==============================================================
> ==========
> I.   RTF APPROACH ('built up' variable)
>       A.   "EMPTY-TEXT" Test  <xsl:when 
> test="not($msg-fill-contents='')">
>          1. with... Correct Lookup?
>                a. WITHSpace?      OK
> >>>>>>>>>>>>>   b. WITHOUTSpace   **FAIL** #1 (This was the 
> original problem; 
> now understood: I had the wrong test!)
>          2. with... BROKEN Lookup?  (Broken lookup fails 
> first, and is correctly
>           CAUGHT by the test. Good.)
>                a. WITHSpace?      OK
>                b. WITHOUTSpace   OK
> 
>       B.   "NODESET PRESENCE" Test  <xsl:when 
> test="$msg-fill-contents">
>          1. with... Correct Lookup?
>                a. WITHSpace?      OK
>                b. WITHOUTSpace   OK = INTERESTING SUCCESS 
> CASE (second rank)
>          2. with... BROKEN Lookup?  (Broken lookup should 
> fail (!) first, BUT is
>           incorrectly MISSED (by my test, anyway). Bad.)
> >>>>>>>>>>>>>   a. WITHSpace?      **FAIL** #2 (THIS IS THE 
> MOST INTERESTING "FAIL". 
> WHY DOES IT FAIL?)
>                b. WITHOUTSpace   **FAIL** #3
> 
> --------------------------------------------------------------
> -----------
> II. NODESET APPROACH ('select' variable)
>       A. "EMPTY-TEXT" Test  <xsl:when 
> test="not($msg-fill-contents='')">
>          1. with... Correct Lookup?
>                a. WITHSpace?      OK
>                b. WITHOUTSpace   **FAIL** #4
>          2. with... BROKEN Lookup?  (Broken lookup should 
> fail (!) first, BUT is
>           incorrectly MISSED (by my test, anyway). Bad.)
>                a. WITHSpace?      **FAIL** #5
>                b. WITHOUTSpace   **FAIL** #6
>             
> >>>>   B. "NODESET PRESENCE" Test  <xsl:when 
> test="$msg-fill-contents">
>          1. with... Correct Lookup?
>                a. WITHSpace?      OK
>                b. WITHOUTSpace   OK = INTERESTING SUCCESS 
> CASE (first rank)
>          2. with... BROKEN Lookup?  (Broken lookup fails 
> first, and is 
>          correctly CAUGHT by the test. Good.)
>                a. WITHSpace?      OK
>                b. WITHOUTSpace   OK
> ======================================================================
> 
> Debug Output Results:
> 
> FAIL CASE #1   (This was the original problem; now 
> understood: wrong test!)
> I. A. 1. b. = RTF | Empty-Text | Correct Lookup | WITHOUTSpace
>       SHOULD GO THROUGH!!   **FAIL**  Does *Not* get through  
>       (through my test, anyway)! Bad.
>       (As you can see in the debug output's "copy-of", there 
> is _something_ 
>       in there, but it is "Empty Element Content Only (No 
> Whitespace)".  Hmmm.)
> DEBUG: XSL:OTHERWISE xsl:when 
> test="not($msg-fill-contents='')" was FALSE, apparently.
> $MSG-NAME:  [hdr-logo] 
> $MSG-FILL-CONTENTS VALUE-OF:  [] 
> $MSG-FILL-CONTENTS COPY-OF:  [<img src="acmebank.gif" 
> alt="Acme Bank">]
> WARNING: $msg-fill-contents lookup came back EMPTY, apparently.
>                      
>          
> FAIL CASE #2   (THIS IS THE MOST INTERESTING "FAIL". WHY DOES 
> IT FAIL?)
> (See Also HTML Code pasted in above)
> I. B. 2. a. = RTF | Nodeset | BROKEN Lookup | WITHSpace
>       SHOULD NOT GO THROUGH!!   **FAIL**  It does *Not* get caught 
>       (by my test, anyway)! Bad.
> (As you can see in the debug output's "$msg-fill-contents copy-of", 
>  there is nothing in there (?). So why doesn't the test catch that?  
>  Must be some lingering node in there, or some such??...)
> XALAN (Version: I have Java 1.4.1_01)
> DEBUG: WE ARE INSIDE xsl:when test="$msg-fill-contents" was 
> TRUE, apparently.
> $MSG-NAME:  [hdr-logo] 
> $MSG-FILL-CONTENTS VALUE-OF:  [] 
> $MSG-FILL-CONTENTS COPY-OF:  []
> 
> SAXON (Instant, 6.5.2)
> DEBUG: WE ARE INSIDE xsl:when test="$msg-fill-contents" was 
> TRUE, apparently.
> $MSG-NAME:  [hdr-logo] 
> $MSG-FILL-CONTENTS VALUE-OF:  [] 
> $MSG-FILL-CONTENTS COPY-OF:  []   
> 
> 
> FAIL CASE #3
> I. B. 2. b. = RTF | Nodeset | BROKEN Lookup | WITHOUTSpace
> 
>          { Exactly the same as FAIL CASE #2 } 
>          (with or without space doesn't matter)
> 
> 
> FAIL CASE #4
> II. A. 1. b. = Nodeset | Empty-Text | Correct Lookup | 
> WITHOUTSpace  (Akin to #1)
>       SHOULD GO THROUGH!!   **FAIL**  Does *Not* get through! Bad.
>       (As you can see in the debug output's "copy-of", there is 
>       _something_ in there. (Is this _output_ "Empty Element 
> Content Only 
>       (No Whitespace)"? Doesn't seem to be, for what it's 
> worth...)  Hmmm.)
> DEBUG: XSL:OTHERWISE not($msg-fill-contents='')" was FALSE, apparently
> $msg-name:  [cta-learn-more]
> $msg-fill-contents value-of:  []
> $msg-fill-contents copy-of:  [<markup>
> <image WRsource="images/singlefocus_button_1.gif"></image>
> </markup>]
> WARNING: $msg-fill-contents lookup came back EMPTY, apparently.   
> 
>          
> FAIL CASE #5
> II. A. 2. a. = Nodeset | Empty-Text | BROKEN Lookup | 
> WITHSpace  (Akin to #2)
>       SHOULD NOT GO THROUGH!!   **FAIL**  It does *Not* get caught 
>       (by my test, anyway)! Bad.
>          (As you can see in the debug output's "copy-of", 
> there is nothing 
>          in there (?).)
> DEBUG: WE ARE INSIDE. xsl:when 
> test="not($msg-fill-contents='')" was TRUE, apparently
> $msg-name:  [cta-learn-more]
> $msg-fill-contents value-of:  []
> $msg-fill-contents copy-of:  []   
> 
>                         
> FAIL CASE #6
> II. A. 2. b. = Nodeset | Empty-Text | BROKEN Lookup | WITHOUTSpace
> 
>       { Exactly the same as FAIL CASE #5 } 
>       (with or without space doesn't matter)
> 
> 
> --------------------------------------------------
> INTERESTING SUCCESS CASE (first)(best) This one fixes the 
> original problem.
> II. B. 1. b.  Nodeset | Nodeset | Correct Lookup | WITHOUTSpace
>       SHOULD GO THROUGH!!   **OK**  *Does* get through! Good.
>       (As you can see in the debug output's "copy-of", there is 
>       _something_ in there, AND, we *did* successfully get past the 
>       xsl:when test for "non-empty" $msg-fill-contents.  O.K.)
> DEBUG: WE ARE INSIDE. xsl:when test="$msg-fill-contents" was 
> TRUE, apparently
> $msg-name:  [cta-learn-more]
> $msg-fill-contents value-of:  []
> $msg-fill-contents copy-of:  [<markup>
> <image WRsource="images/singlefocus_button_1.gif"></image>
> </markup>]      
> 
>                
>                
> INTERESTING SUCCESS CASE (second)(qualified)
> I. B. 1. b.  = RTF | Nodeset | Correct Lookup | WITHOUTSpace
>       SHOULD GO THROUGH!!   **OK**  *Does* get through! Good.
>       (As you can see in the debug output's "copy-of", there 
> is _something_ 
>       in there, AND, we *did* successfully get past the xsl:when test 
>       for "non-empty" $msg-fill-contents.  O.K.)
> DEBUG: WE ARE INSIDE. xsl:when test="$msg-fill-contents" was 
> TRUE, apparently
> $msg-name:  [cta-learn-more]
> $msg-fill-contents value-of:  []
> $msg-fill-contents copy-of:  [<img 
> src="images/singlefocus_button_1.gif" alt="">] 
> 
> [...But, note that this "second" SUCCESS CASE in turn FAILS 
> when the Lookup 
>  is BROKEN: I. B. 2. a|b.]
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> +++++++++++++++++
>       /END of RESULTS MATRIX
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> +++++++++++++++++
> 
> 
> 
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> +++++++++++++++++
>    "BIBLIOGRAPHY" - URL links to related earlier XSL-List postings
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> +++++++++++++++++
> 
> === WR E-MAILS ===================================================
> William Reilly 1st e-mail [Tue, 22 Apr 2003 22:10:48 -0400]
> Subj:  xsl:copy-of O.K. on RTF, but nothing on <EMPTY/> 
> element content (?)
> http://www.biglist.com/lists/xsl-list/archives/200304/msg01075.html
> 
> William Reilly 2nd e-mail [Wed, 23 Apr 2003 17:30:01 -0400]
> Subj: RE:  xsl:copy-of O.K. on RTF, but nothing on 
> <EMPTY/> element content (?)
> http://www.biglist.com/lists/xsl-list/archives/200304/msg01138.html
> 
> William Reilly 3rd e-mail (response to Leena Kulkarni e-mail) 
>  [Fri, 25 Apr 2003 14:42:52 -0400]
> Subj: RE:  difference between Result Tree Fragment (RTF) 
> and a nodeset
> http://www.biglist.com/lists/xsl-list/archives/200304/msg01245.html
> === /WR E-MAILS ===================================================
> 
> === RESPONSES =====================================================
> Wendell Piez 1st (response to WR 2nd e-mail) [Fri, 25 Apr 
> 2003 13:44:41 -0400]
> Subj: RE:  xsl:copy-of O.K. on RTF, but nothing on 
> <EMPTY/> element content (?)
> http://www.biglist.com/lists/xsl-list/archives/200304/msg01244.html
> 
> Wendell Piez 2nd (response to WR 3rd e-mail (response to 
> Leena Kulkarni)) [Fri, 25 Apr 2003 15:43:24 -0400]
> Subj: RE:  difference between Result Tree Fragment (RTF) 
> and a nodeset
> http://www.biglist.com/lists/xsl-list/archives/200304/msg01246.html
> 
> Michael Kay (response to WR 3rd e-mail (response to Leena 
> Kulkarni)) [Fri, 25 Apr 2003 21:33:23 +0100]
> Subj: RE:  difference between Result Tree Fragment (RTF) 
> and a nodeset
> http://www.biglist.com/lists/xsl-list/archives/200304/msg01247.html
> 
> G. Ken Holman (response to Leena Kulkarni e-mail) [Fri, 25 
> Apr 2003 12:54:53 -0400]
> Subj: Re:  difference between Result Tree Fragment (RTF) 
> and a nodeset
> http://www.biglist.com/cgi-bin/wilma/wilma_hiliter/xsl-list/20
0304/msg01234.html
=== /RESPONSES =====================================================
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++
   /END of E-Mail
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++

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


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


Current Thread

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.