Menu

Temporary XSL transformation

Help
2003-11-13
2004-04-13
  • Eric Fesler

    Eric Fesler - 2003-11-13

    Hi,

    I'm trying to process an XML message and in the middle of the process, I need to query an XML DB to see if the message has already previously handled.
    Depending upon the result of the request, I have to route the message through different stage.

    I thought to use the HttpClient and the Router Stage. However, the XML message needed for the query is not the same as the original message. Therefore I need to find a way to temporary transform the message to issue the XML database query, then I have to take back the original message and process it.

    I thought to use the Domify stage to temporary saved the original message but I don't find an esay way to get it back as document content.

    Does anybody have an idea to solve this type of flow?

    Thanks,

    --ERic

     
    • Robert Fuller

      Robert Fuller - 2003-11-24

      One thing you could do is to assign the original content as an attribute of the PipelineDocument.  You could do this, for example, using a scripting pipeline stage.  Then after you do your transformations, etc., you would still have access to the original array of bytes by retrieving the attrbibute.

      eg:
      document.put("originalContent",
                          document.getBytes());

      //then later to do the reset...

      document.setBytes(
                  (byte[])document.get("originalContent");

      I think this should work...

       
    • Martin Logan

      Martin Logan - 2004-04-13

      Did this work?

      I am trying it and get
      <2004-04-13 12:43:01,870> ERROR [main] :  [DefaultPipelineStageErrorHandler.hand
      lePipelineStageError] PipelineStage name: docfromattribute Error: com.babeldoc.c
      ore.pipeline.PipelineException: Script processing failed
      <2004-04-13 12:43:01,885> ERROR [main] :  [PipelineFeeder.process]
      com.babeldoc.core.pipeline.PipelineException: Script processing failed
      ....
      -- Removed some of the errors....
      ....
      Caused by: org.apache.bsf.BSFException: JavaScript Error: Internal Error: Syntax
      Error: identifier is a reserved word (<BABELDOC>; )
      after
      document.setBytes(
      (byte[])document.get("originalContent"));

       
    • Martin Logan

      Martin Logan - 2004-04-13

      Some kind of extension to XPathExtract to get an attribute from and external file (Or an equivalent to SQL enrich for an XML file) would be less convoluted but...

      with a slight change it works

      document.put("originalContent", document.getBytes());

      and then

      document.setBytes(document.get("originalContent"));

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.