On 7/30/05, Rolando Isidoro <[EMAIL PROTECTED]> wrote: > >Tracing the pipeline: > >The URL is like: http://yourserver/xxx/staff/empname/profile > >It uses the first match and aggregates the navigation with: > >cocoon:/staff-empname > > > >"empname" must be "asg" for your test, since you hardcoded the second > >pipeline. Now we assume it was so we hit the second pipeline. It > >gets the hardcoded page, does a transform, then passes back XML. > > > The second pipeline is hardcoded on purpose, since I have 10 staff > members and for each one of them the query string URL differs, so > ultimately I will have 10 secondary pipelines. Is this a correct line of > thought? > > > >The first pipeline takes all the XML, does a transform, then returns HTML. > >As long as your page2xhtml.xsl produces something close to HTML, this > >should work fine. > > > With this last paragraph you wrote I detected an error in my thinking; I > removed the page2xhtml.xsl transformation from that code block and now I > get data from both pipelines. I've created a simple webpage describing > everything, accessible under http://rolando.serrado.net; I'd appreciate > if you could take a look at it and send me some feedback on what to > change under publication-sitemap.xmap in order to get the wanted result.
You definitely need a transform in the first pipeline. I suggest making a copy of page2xhtml.xsl and name it page2xhtml-staffdetails.xsl. Use that for development. If you find you did not need it, you can always change the transform back. Your second pipeline is retreiving the data, and formatting it as the TABLE you desire. Your final transform needs create the page with the table in the correct place. The question is how you want this to happen. Does the original page use standard Lenya URLs? Does the "details" page only show when using the "staff" pipeline? Or do they both use the same URL? It is easiest if the URLs are different so you create separate pipelines: http://yourserver/xxx/staff/empname/profile http://yourserver/xxx/staff/empname/details (Wait until later after the differences are explained.) (You could merge the pipelines in a variety of ways, but I am keeping it simple. Try using Resources if you find you are using the same code in multiple pipelines, but wait until it works before worrying about maintenance.) Make certain OAI2xhtml.xsl wraps the table in a <div id="details">. Then page2xhtml-staffdetails.xsl replaces the link with the details DIV. You should pass empname from the pipeline so you can use it in the link: <map:transform src="xslt/page2xhtml-staffdetails.xsl"> <map:parameter name="empname" value="{2}"/> </map:transform> The XSL needs to set it: <xsl:param name="empname"> Where you want the link or details, put: <div id="details-or-link"/> Add a template to fill the correct details: <xsl:template match="[EMAIL PROTECTED] = 'details-or-link']"> <xsl:choose> <xsl:when test="[EMAIL PROTECTED] = 'details']"> <xsl:apply-templates select="[EMAIL PROTECTED] = 'details']"/> </xsl:when> <xsl:otherwise> Click <a href="/staff/{$empname}/details">here</a> for a more detailed profile </xsl:otherwise> </xsl:choose> (Depending on your code, it may be "xhtml:div[" rather than "div[".) Now create your 2 pipelines: <map:match pattern="**/staff/*/profile*"> Does not aggregate with the external data pipeline. Since the details DIV is missing, it shows the link. <map:match pattern="**/staff/*/details*"> Aggregate the external data pipeline. Since it has the details DIV, that is copied into the document. === Adding a pipeline for each employee? NO! Pass the employee name in the URL. You already started that with the {2} in the first pipeline. The second pipeline should start: <map:match pattern="staff-*"> <map:generate src="http://rolando.serrado.net/cwis/SPT--OAI.php?verb=ListRecords&metadataPrefix=oai_dc&set=Creator:{1}"/> Now you have a problem: - Can you do the external lookup using "asg"? - Can you change the Lenya URLs to: /staff/Adolfo%20Steiger/profile - Must you translate the name? The first two are easier because you are standardizing the key. To do a translation, check out the last example on: http://cocoon.apache.org/2.1/userdocs/selectors/parameter-selector.html <map:match pattern="**/staff/*/details*"> <map:select type="parameter"> <map:parameter name="parameter-selector-test" value="{2}"/> <map:when test="asg"> <map:generate src="http://rolando.serrado.net/cwis/SPT--OAI.php?verb=ListRecords&metadataPrefix=oai_dc&set=Creator:Adolfo%20Steiger"/> </map:when> <!-- Repeat last 3 lines for other people --> <map:otherwise> <map:redirect-to uri="other_URI"/> </map:otherwise> </map:select> <map:transform src="xslt/OAI2xhtml.xsl"/> <map:serialize type="xml"/> </map:match> DISCLAIMER: I wrote all of this quickly with no testing. Good luck, solprovider --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
