Let's just try this again... ;)
 
James,
 
This is just a shot in the dark, but from the syntax below, the xslt migh barf. Isn't 
the syntax for conditionals in xslt as follows:

<map:select type="xml" node="/result">
<map:choose>
    <map:when test="flag='normalResult'">
      <map:transform src="styles/normal.xsl" />
    </map:when>
    <map:when test="flag='specialResult'">
      <map:transform type="custom-ejb-interface">
        ...
      </map:transform>
      <map:transform src="styles/special.xsl" />
    </map:when>
    <map:otherwise>
     {put in something that does the transformation in case all the above conditionals 
fail}
    </map:otherwise>
</map:choose>
</map:select>
 
the single-line conditional could be
<map:select type="xml" node="/result">
  <map:if test="flag='normalResult'">
      <map:transform src="styles/normal.xsl" />
    </map:if>
    <map:if test="flag='specialResult'">
      <map:transform type="custom-ejb-interface">
        ...
      </map:transform>
      <map:transform src="styles/special.xsl" />
    </map:if>
</map:select>
 
except that I have no idea as to what the net-effect of the 'if'-statements are.
 
Sincerely,
Georg von Sperling
MedAptus, Inc.
www.medaptus.com <http://www.medaptus.com> 
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> 
 
 

        -----Original Message----- 
        From: James Burton [mailto:[EMAIL PROTECTED]] 
        Sent: Wed 2/27/2002 6:15 AM 
        To: [EMAIL PROTECTED] 
        Cc: 
        Subject: XML-Based Selection (Redirect Serializer?)
        
        

        Hi all!  We're working on a Cocoon 2 project and
        *very* strongly need the ability to "branch" to a
        different pipeline or part of a pipeline based on the
        XML output of a Transformer.  This is because we use a
        custom Transformer for communicating with an EJB back
        end.  Originally I thought to use an XML selector like
        this:
        
        <map:match pattern="example">
          <map:generate src="..." />
          <map:transform type="custom-ejb-interface">
            ...
          </map:transform>
          <map:select type="xml" node="/result/flag">
            <map:when test="normalResult">
              <map:transform src="styles/normal.xsl" />
            </map:when>
            <map:when test="specialResult">
              <map:transform type="custom-ejb-interface">
                ...
              </map:transform>
              <map:transform src="styles/special.xsl" />
            </map:when>
          </map:select>
          <map:serialize />
        </map:match>
        
        However I found in the mail archives (Subject: XML
        selector) that this method does not work because
        Selectors have no access to the XML results of
        Transformers.  For similar reason a custom Matcher
        wouldn't work either.  But this functionality is
        crucial!
        
        Therefore, I wondered if it would be possible for me
        to create a "redirecting serializer": one that would
        call a different pipe (or a different resource) based
        on the final XML feed.  In other words something like
        this:
        
        <map:match pattern="example">
          <map:generate src="..." />
          <map:transform type="custom-ejb-interface">
            ...
          </map:transform>
          <map:serialize type="redirector">
            <map:parameter name="node" value="result/flag" />
            <map:parameter name="match1" value="normal" />
            <map:parameter name="call1" value="normal-pipe" />
            <map:parameter name="match2" value="special" />
            <map:parameter name="call2" value="special-pipe"
        />
          </map:select>
        </map:match>
        
        Can someone give me a hint for how to start
        implementing this?  I know how to make a Serializer,
        but don't know what it would call to start invoking a
        pipe with a different URL (I imagine it must be
        similar to the implementation of <map:call>).  Or, if
        this is not going to work, could somebody let me know?
         In that case, I think the only alternative left is to
        make a serializer that issues an HTTP redirect to a
        given URL based on its parameters; i.e. a
        "RedirectSerializer".  I would be happy to contribute
        this serializer if I can get it to work.
        
        Many thanks from Prague,
        James Burton
        
        
        __________________________________________________
        Do You Yahoo!?
        Yahoo! Greetings - Send FREE e-cards for every occasion!
        http://greetings.yahoo.com
        
        ---------------------------------------------------------------------
        To unsubscribe, e-mail: [EMAIL PROTECTED]
        For additional commands, email: [EMAIL PROTECTED]
        
        



Reply via email to