Re: [Hypercontent-users] XML/XSL Include
Brought to you by:
alexvigdor
From: Carl B. <C.P...@hu...> - 2006-04-28 14:56:16
|
Thanks Alex, Thats working great now. I'm actually building the site in version 2.0, just because I find it much easier to develop in. I'll dump it all itnto1.4 before going live. The wrong way round to do things I know, but I can't roll out 2.0 to everyone at the moment. I'm not too bothered about the same day sorting in version 1.4. It will be okay. Cheers Carl Alex Vigdor wrote: > HI Carl, > The creation date is available via dublin core metadata, i.e. > > /cms:wrapper/cms:include/rdf:RDF/cfs:File/dc:date > > In the current release this is only a date stamp, so the sorting isn't > reliable between items created on the same day. The CVS code is > already updated so this is a date-time stamp. It's in ISO 8601 format > ("yyyy-MM-dd HH:mm:ssZ") which means it can be sorted > lexicographically without parsing the date. > > Cheers, > Alex > > On Apr 28, 2006, at 6:41 AM, Carl Barrow wrote: > >> Hi Alex, >> >> I see... I think I'll go for the RSS rendered news with it's own >> navigation file when I properly switch to version 2.0. I intend this >> to be after the summer. News items on our main public site could >> well get into the hundreds. >> >> For now, how would I actually get to the filedate. I can sort by >> various parts of the XML file <xsl:sort select="@title"> but I need >> to sort by the date the file was created/edited. >> >> Cheers >> Carl >> >> Alex Vigdor wrote: >>> Hi Carl, >>> You can use an XSL sort at the point you apply-templates for >>> "newsbodytext" to sort based on date. Part of the advantage of >>> using a navigation file for this is overall better performance, >>> especially if you get to the point where you're trying to pick the 5 >>> most recent out of hundreds. >>> >>> Cheers, >>> Alex >>> >>> On Apr 27, 2006, at 9:20 AM, Carl Barrow wrote: >>> >>>> This might actually be flawed. It seems the elements are numbers >>>> in alphabetical order not as they are added so the numbers actually >>>> change. So what I thought would be the latest 5 are simply the >>>> first 5 in alphabetical order. Do you have any ideas how to solve >>>> that? >>>> >>>> Cheers >>>> Carl >>>> >>>> Carl Barrow wrote: >>>>> 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 >>>> ***************************************************************************************** >>>> >>> >>> >>> >>> ------------------------------------------------------- >>> 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 ***************************************************************************************** |