Re: [Hypercontent-users] XML/XSL Include
Brought to you by:
alexvigdor
From: Carl B. <C.P...@hu...> - 2006-04-27 12:41:28
|
Hi Alex, I didn't really want to create a specific navigation file for news and events so I've have set the news and events to order by date and done it as follows: <xsl:template match="newsbodytext"> <xsl:variable name="emailadd" select="@email"/> <xsl:variable name="pos" select="position()"/> <xsl:variable name="include" select="ancestor::cms:include"/> <xsl:if test="$pos < '5'"> <a href="{$rel-project-base}{$include/@directory}{$include/@basename}.html"> <xsl:value-of select="@title"/> </a> <br/> <xsl:value-of select="summary"/> </xsl:if> </xsl:template> Is that an 'okay' way of doing it? Is the velocity template the one used for the ja-sig site? I have downloaded that and did use the RSS generation on a test site here. It works really well. However, at the moment since I am only live with 1.4 I haven't been able to use it for anything live. Cheers Carl Alex Vigdor wrote: > Hi Carl, > To generate a "top 5" list, I recommend creating a specific > navigation file to represent the list. You could set the root > nav-template to "/news/index.xml" and a child template to > "/news/*.xml", or whatever the appropriate pattern is; then set the > root template to sort children by date descending, and set the > maxChildren attribute to 5. I also have a velocity template that will > render such a navigation file to RSS if you're interested. > > Cheers, > Alex > > On Apr 26, 2006, at 7:31 AM, Carl Barrow wrote: > >> Hi Alex, >> >> This has worked very well, I am using it for news and events too. I >> am generating a news index but also want to add the latest 5 news >> items on the Homepage. I was thinking that I could use something like: >> >> <xsl:variable name="include" select="ancestor::cms:include[position() >> < 6]"/> >> >> But I don't seem to be able to get it to work. Am I going about it >> the right way? >> >> Cheers >> Carl >> >> Alex Vigdor wrote: >>> Hi Carl, >>> Something like >>> <xsl:variable name="include" select="ancestor::cms:include"/> >>> <a >>> href="{$rel-project-base}{$include/@directory}{$include/@basename}.html"> >>> >>> <xsl:value-of select="@firstname"/> >>> <xsl:value-of select="@lastname"/> >>> </a> >>> >>> By the way, have you considered using VCard for this information? >>> Then you could set it up to populate from LDAP, and get addressbook >>> integration as well. We'll often use VCard for basic contact info, >>> then use either additional attributes in the XML for more specific >>> info like office hours, degrees, etc., or put it in the VCard note >>> so it will show up in your addressbook as well. >>> >>> Cheers, >>> Alex >>> >>> On Apr 24, 2006, at 11:13 AM, Carl Barrow wrote: >>> >>>> Thanks Alex, >>>> >>>> Thats working for me now. I've turned the email address into a >>>> link easy enough, but I want to turn the persons name into a link >>>> to their page. I have only just started looking at it now, do you >>>> have any pointers? >>>> >>>> Cheers >>>> Carl >>>> >>>> Alex Vigdor wrote: >>>>> Hi Carl, >>>>> What about something like this: >>>>> >>>>> <xsl:apply-templates >>>>> select="/cms:wrapper/cms:include/page/bodytext" /> >>>>> >>>>> <xsl:template match="bodytext"> >>>>> <xsl:value-of select="@firstname"/> >>>>> <xsl:value-of select="@lastname"/> >>>>> <xsl:value-of select="@email"/> >>>>> </xsl:template> >>>>> >>>>> You'll of course need to make sure that your include has the >>>>> attribute data="yes". >>>>> >>>>> Cheers, >>>>> Alex >>>>> >>>>> On Apr 24, 2006, at 8:22 AM, Carl Barrow wrote: >>>>> >>>>>> Hi Alex, >>>>>> >>>>>> On one of the sites here in Hull I have a file for each member of >>>>>> staff with the following dtd to define it: >>>>>> >>>>>> <!ELEMENT page (rightbox*,bodytext,leftbox?)> >>>>>> <!ELEMENT rightbox (html)> >>>>>> <!ELEMENT bodytext >>>>>> (photo,qualifications,researchinterests,researchcategories,biography,modulestaught,memberships,publications)> >>>>>> >>>>>> <!ELEMENT photo (html)> >>>>>> <!ELEMENT qualifications (html)> >>>>>> <!ELEMENT researchinterests (html)> >>>>>> <!ELEMENT researchcategories (html)> >>>>>> <!ELEMENT biography (html)> >>>>>> <!ELEMENT modulestaught (html)> >>>>>> <!ELEMENT memberships (html)> >>>>>> <!ELEMENT publications (html)> >>>>>> <!ELEMENT leftbox (html)> >>>>>> <!ATTLIST rightbox title CDATA #REQUIRED> >>>>>> <!ATTLIST leftbox title CDATA #REQUIRED> <!ATTLIST bodytext title >>>>>> CDATA #REQUIRED> >>>>>> <!ATTLIST bodytext firstname CDATA #REQUIRED> >>>>>> <!ATTLIST bodytext lastname CDATA #REQUIRED> >>>>>> <!ATTLIST bodytext academictitle CDATA #REQUIRED> >>>>>> <!ATTLIST bodytext honorarytitle CDATA #REQUIRED> >>>>>> <!ATTLIST bodytext extention CDATA #REQUIRED> >>>>>> <!ATTLIST bodytext roomnumber CDATA #REQUIRED> >>>>>> <!ATTLIST bodytext email CDATA #REQUIRED> >>>>>> <!ATTLIST page navigationtitle CDATA #REQUIRED> >>>>>> >>>>>> I want to include the firstname, lastname and email for each >>>>>> member of staff on an index page. At the moment I only seem to >>>>>> be able to include everything on a staff page The code I have >>>>>> is as follows: >>>>>> >>>>>> >>>>>> <xsl:template name="bodytext"> >>>>>> <xsl:for-each >>>>>> select="/cms:wrapper/cms:include[@pattern='/people/staff/*.xml']"> >>>>>> <xsl:apply-templates /> >>>>>> </xsl:for-each> >>>>>> </xsl:template> >>>>>> >>>>>> I though I would be able to use: >>>>>> <xsl:apply-templates >>>>>> select="/cms:wrapper/cms:source/page/bodytext/@firstname" /> >>>>>> >>>>>> but that isn't working. Can you see what I'm doing wrong at all? >>>>>> >>>>>> Cheers >>>>>> Carl >>>>>> >>>>>> --************************************ >>>>>> >>>>>> Carl Barrow >>>>>> Systems Integrator >>>>>> e-Services >>>>>> The University of Hull >>>>>> Cottingham Road >>>>>> Hull >>>>>> HU6 7RX >>>>>> Ext. 6838 >>>>>> ************************************ >>>>>> >>>>>> ***************************************************************************************** >>>>>> >>>>>> To view the terms under which this email is distributed, please >>>>>> go to http://www.hull.ac.uk/legal/email_disclaimer.html >>>>>> ***************************************************************************************** >>>>>> >>>>>> >>>>>> >>>>>> ------------------------------------------------------- >>>>>> Using Tomcat but need to do more? Need to support web services, >>>>>> security? >>>>>> Get stuff done quickly with pre-integrated technology to make >>>>>> your job easier >>>>>> Download IBM WebSphere Application Server v.1.0.1 based on Apache >>>>>> Geronimo >>>>>> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 >>>>>> >>>>>> _______________________________________________ >>>>>> Hypercontent-users mailing list >>>>>> Hyp...@li... >>>>>> https://lists.sourceforge.net/lists/listinfo/hypercontent-users >>>>> >>>>> >>>>> >>>>> ------------------------------------------------------- >>>>> Using Tomcat but need to do more? Need to support web services, >>>>> security? >>>>> Get stuff done quickly with pre-integrated technology to make your >>>>> job easier >>>>> Download IBM WebSphere Application Server v.1.0.1 based on Apache >>>>> Geronimo >>>>> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 >>>>> >>>>> _______________________________________________ >>>>> Hypercontent-users mailing list >>>>> Hyp...@li... >>>>> https://lists.sourceforge.net/lists/listinfo/hypercontent-users >>>> >>>> --************************************ >>>> >>>> Carl Barrow >>>> Systems Integrator >>>> e-Services >>>> The University of Hull >>>> Cottingham Road >>>> Hull >>>> HU6 7RX >>>> Ext. 6838 >>>> ************************************ >>>> >>>> ***************************************************************************************** >>>> >>>> To view the terms under which this email is distributed, please go >>>> to http://www.hull.ac.uk/legal/email_disclaimer.html >>>> ***************************************************************************************** >>>> >>> >>> >>> >>> ------------------------------------------------------- >>> Using Tomcat but need to do more? Need to support web services, >>> security? >>> Get stuff done quickly with pre-integrated technology to make your >>> job easier >>> Download IBM WebSphere Application Server v.1.0.1 based on Apache >>> Geronimo >>> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 >>> >>> _______________________________________________ >>> Hypercontent-users mailing list >>> Hyp...@li... >>> https://lists.sourceforge.net/lists/listinfo/hypercontent-users >> >> --************************************ >> >> Carl Barrow >> Systems Integrator >> e-Services >> The University of Hull >> Cottingham Road >> Hull >> HU6 7RX >> Ext. 6838 >> ************************************ >> >> ***************************************************************************************** >> >> To view the terms under which this email is distributed, please go to >> http://www.hull.ac.uk/legal/email_disclaimer.html >> ***************************************************************************************** >> > > > > ------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job > easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache > Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > Hypercontent-users mailing list > Hyp...@li... > https://lists.sourceforge.net/lists/listinfo/hypercontent-users -- ************************************ Carl Barrow Systems Integrator e-Services The University of Hull Cottingham Road Hull HU6 7RX Ext. 6838 ************************************ ***************************************************************************************** To view the terms under which this email is distributed, please go to http://www.hull.ac.uk/legal/email_disclaimer.html ***************************************************************************************** |