|
Let me start by apologizing for the length of
this message, it might become somewhat confusing.
I forgot to mention in previous occasions that every regular staff document is a custom resource type called "profile". I've created profile2xhtml.xsl and page2xhtml-profile.xsl as instructed in http://lenya.apache.org/1_2_x/how-to/custom_resourcetype.html. 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 I use two distinct URLs, for the common profile I use the 1st (standard Lenya URL) and the 2nd for the one with external data integration: http://gris.uninova.pt:8080/lenya/gris/live/staff/asg/ http://gris.uninova.pt:8080/lenya/gris/live/staff/asg/profile You can visit these URLs to get a clearer idea, as they are available online, but be aware that this publication hasn't been updated with the changes I've been performing. Done, as mentioned before your page2xhtml-staffdetails.xsl is named page2xhtml-profile.xsl.Make certain OAI2xhtml.xsl wraps the table in a <div id="details">. Then page2xhtml-staffdetails.xsl replaces the link with the details DIV. Done. I've also passed some other parameters that are needed to present the rest of the data correctly under page2xhtml-profile.xsl: <map:transform src=""> <map:parameter name="document-id" value="{page-envelope:document-id}"/> <map:parameter name="document-type" value="profile"/> <-- hardcoded because value="{page-envelope:document-type}" returned an error <map:parameter name="language" value="{page-envelope:document-language}"/> <map:parameter name="root" value="{page-envelope:context-prefix}/gris/live"/> <-- hardcoded because the matching doesn't return {publication-id} and {area} <map:parameter name="staff_id" value="{2}"/> </map:transform> This way, from what I can figure out, I'll have to insert <div id="details-or-link"/> in each index_*.xml for every staff member, right?Where you want the link or details, put: <div id="details-or-link"/> Did that.
This template goes in page2xhtml-profile.xml?Here a small issue appears, I'm using two different strings for the link, one in PT and other one in EN, which means I'll have to pass <map:parameter name="language" value="{page-envelope:document-language}"/> in the pipeline into page2xhtml-profile.xsl and the XSL must have <xsl:param name="language"/>, so I can later distinguish which language the page is written in and display the right string for it, right? I've introduced the following block of code under page2xhtml-profile.xsl and neither the links or the details div are showing up: <xsl:template match="xhtml:[EMAIL PROTECTED]'details-or-link']"> <xsl:choose> <xsl:when test="[EMAIL PROTECTED]'details']"> <xsl:apply-templates select="[EMAIL PROTECTED]'details']"/> </xsl:when> <xsl:otherwise> <xsl:if test="$language='en'"> Click <a href="">here</a> for a more detailed profile. </xsl:if> <xsl:otherwise> Clique <a href="">aqui</a> para um perfil mais detalhado. </xsl:otherwise> </xsl:otherwise> </xsl:choose> </xsl:template> I've created the 2 pipelines as you suggested, this is how they look: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. <map:pipeline> <map:match pattern="lenyabody-*/*/*/staff/*"> <map:aggregate element="cmsbody"> <map:part src=""/> <map:part src=""/> <map:part src=""/> <map:part src=""/> <map:part src=""/> </map:aggregate> <map:transform src=""> <map:parameter name="document-id" value="{page-envelope:document-id}"/> <map:parameter name="document-type" value="profile"/> <map:parameter name="language" value="{page-envelope:document-language}"/> <map:parameter name="root" value="{page-envelope:context-prefix}/gris/live"/> <map:parameter name="url" value="{2}"/> </map:transform> <map:select type="parameter"> <map:parameter name="parameter-selector-test" value="{1}"/> <map:when test="view"> <map:transform type="link-rewrite"/> </map:when> </map:select> <map:serialize type="html"/> </map:match> </map:pipeline> <map:pipeline> <!-- /lenyabody-{rendertype}/{publication-id}/{area}/{doctype}/{url} --> <map:match pattern="**/staff/*/profile"> <map:aggregate element="cmsbody"> <map:part src=""/> <map:part src=""/> <map:part src=""/> <map:part src=""/> This line is commented because Lenya tries to retrieve the document with ID staff/.../profile which doesn't exist; how can I remove the profile suffix from the document ID, so it will retrieve the correct document? <!-- <map:part src=""/> --> <map:part src=""/> </map:aggregate> <map:transform src=""> <map:parameter name="document-id" value="{page-envelope:document-id}"/> <map:parameter name="document-type" value="profile"/> <map:parameter name="language" value="{page-envelope:document-language}"/> <map:parameter name="root" value="{page-envelope:context-prefix}/gris/live"/> <map:parameter name="staff_id" value="{2}"/> </map:transform> <map:serialize type="html"/> </map:match> <map:match pattern="staff-*"> <map:select type="parameter"> <map:parameter name="parameter-selector-test" value="{1}"/> <map:when test="asg"> <map:generate src="" class="moz-txt-link-rfc2396E" href="http://rolando.serrado.net/cwis/SPT--OAI.php?verb=ListRecords&metadataPrefix=oai_dc&set=Creator:Adolfo%20Steiger">"http://rolando.serrado.net/cwis/SPT--OAI.php?verb=ListRecords&metadataPrefix=oai_dc&set=Creator:Adolfo%20Steiger"/> </map:when> <map:when test="ca"> <map:generate src="" class="moz-txt-link-rfc2396E" href="http://rolando.serrado.net/cwis/SPT--OAI.php?verb=ListRecords&metadataPrefix=oai_dc&set=Creator:Carlos%20Agostinho">"http://rolando.serrado.net/cwis/SPT--OAI.php?verb=ListRecords&metadataPrefix=oai_dc&set=Creator:Carlos%20Agostinho"/> </map:when> .... </map:select> <map:transform src=""/> <map:serialize type="xml"/> </map:match> </map:pipeline> With all this changes made I still can't manage to get the desired result. I can detect 2 things not working correctly: - the <div id="details-or-link"/> isn't rendering neither the link string if a staff member page or the details in a profile staff member page - if I access a page using an URL terminating with staff/.../profile I can't return the content of the respective staff/... document. Thanks for all the help, regards, Rolando |
- Re: Integrating external data into Lenya Rolando Isidoro
- Re: Integrating external data into Lenya Victoria Vitaver
- Re: Integrating external data into Lenya solprovider
- Re: Integrating external data into Lenya Rolando Isidoro
- Re: Integrating external data into Lenya solprovider
