On 23.04.2007 17:27, SETIssl wrote:

I tried to implement a DatabaseSelectAction like its described in the docs and the api, but couldn't find any details or any kind of example on how the request/the sitemap pipeline action part actually should look like.

From rereading the thread I get your case is more complex. The actions might not work or really complicate your sitemap a lot. I'd go with flow script.

To clarify let me rephrase your steps:

1. Get a document from the document system. (How is determined which document?) 2. Parse it for whatever to retrieve norm_id with that information from the database.
3. Switch pipeline depending on this norm_id.

What makes this case really complicated is that you have a two-step-processing of pipeline content. It would be much easier if you could determine the norm_id directly from the "How is determined which document?"-parameters without parsing pipeline content. Is that an option?

Otherwise it could look like the following (you need 3 pipelines):

// same pattern as before
<map:match pattern="">
  // delegate to a flow script function
  <map:call function="processDocument"/>
</map:match>

// get document from document management
<map:match pattern="getDocument">
  <map:generate/>
  <map:serialize/>
</map:match>

// final processing
<map:match pattern="showDocument">
  // it's probably possible to inject the document directly,
  // otherwise get the document from document management again
  <map:generate/>
  <map:select type="parameter">
    <map:parameter name="parameter-selector-test"
                   value="{flow-attr:norm-id}"/>
   <map:when test="2">
     <map:transform src="userfiles/common/xsl/gbrief2pdfDIN676A.xsl"
type="xslt">
     </map:transform>
   </map:when>
   <map:when test="3">
     <map:transform src="userfiles/common/xsl/gbrief2pdfDIN676B.xsl"
type="xslt">
     </map:transform>
   </map:when>
  </map:select>
  <map:serialize/>
</map:match>

flow script:

function processDocument() {
  var pipelineUtil = // get pipelineUtil
  var data = // data you might need to retrieve the document
  var document = pipelineUtil.processToDOM("getDocument", data);
  var normId = // get normId from the DOM
  cocoon.sendPage("showDocument", {"norm-id": normId});
}

Hope this gets you the idea.

2 comments:
1. "getDocument" and "showDocument" should actually go into a <map:pipeline internal-only="true"> section to prevent access from external.

2. And if you do the conversion of the norm_id values 2, 3, etc. to the actual norm strings used in the xsl names in the flow script you can refrain from the select in the pipeline:

function processDocument() {
  ...
  var normId = // get normId from the DOM
  var normName = convertNormIdToNormName(normId);
  cocoon.sendPage("showDocument", {"norm-name": normName});
}

// final processing
<map:match pattern="showDocument">
  // it's probably possible to inject the document directly,
  // otherwise get the document from document management again
  <map:generate/>
  <map:transform src="userfiles/common/xsl/gbrief2pdf{norm-name}.xsl"
  <map:serialize/>
</map:match>

Regards
Joerg

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to