hCalender glean
AnchorMan
- xsl
Hallo zusammen,
ich setze mich mit der glean-hcal.xsl auseinander, die dazu dient, hCalendar Informationen aus HTML-Seiten herauszufiltern.
Dabei habe ich ein grundsätzliches Verständnisproblem: Wozu dient der Parameter "Anchor", der ziemlich früh definiert wird und später immer wieder bei if test-Bedingungen auftaucht? Welchen Wert hat er bei den Bedingungen?
<xsl:stylesheet version="1.0">
<xsl:output indent="yes" method="xml"/>
<xsl:param name="prodid" select=""-//connolly.w3.org//RDF Calendar $Date: 2007/06/30 19:05:32 $ (BETA)//EN""/>
<xsl:param name="CalNS">http://www.w3.org/2002/12/cal/icaltzd#</xsl:param>
<xsl:param name="XdtNS">http://www.w3.org/2001/XMLSchema#</xsl:param>
<!-- by Dan Connolly -->
−
<!--
acks...
brian suda
brian@suda.co.uk
http://suda.co.uk/
XHTML-2-vCard
Version 0.5.1
2005-07-08
Copyright 2005 Brian Suda
This work is licensed under the Creative Commons Attribution-ShareAlike License.
To view a copy of this license, visit
http://creativecommons.org/licenses/by-sa/1.0/
-->
−
<!--
Best Practices states this should be
the URL the calendar was transformed from
-->
−
<xsl:param name="Source">
−
<xsl:choose>
−
<xsl:when test="h:html/h:head/h:link[@rel="base"]">
<xsl:value-of select="h:html/h:head/h:link[@rel="base"]/@href"/>
</xsl:when>
−
<xsl:when test="h:html/h:head/h:base">
<xsl:value-of select="h:html/h:head/h:base/@href"/>
</xsl:when>
</xsl:choose>
</xsl:param>
<xsl:param name="Anchor"/>
<!-- find a vcard for my-events idiom -->
<xsl:param name="Me" select="//*[contains(concat(' ', normalize-space(@class), ' '), ' organizer ')]/@id"/>
−
<xsl:template match="/">
−
<r:RDF>
−
<!--
The Vcalendar object used to be existentially quantified,
but it's convenient to be able to refer to it by URI,
so we say the Source document is the Vcalendar.
-->
−
<c:Vcalendar r:about="{$Source}">
−
<c:prodid>
<xsl:value-of select="$prodid"/>
</c:prodid>
<c:version>2.0</c:version>
<xsl:apply-templates/>
</c:Vcalendar>
</r:RDF>
</xsl:template>
<!-- Each event is listed in succession -->
−
<xsl:template match="*[contains(concat(' ',normalize-space(@class),' '),' vevent ')]">
−
<xsl:if test="not($Anchor) or @id = $Anchor">
−
<c:component>
−
<c:Vevent>
<xsl:call-template name="cal-props"/>
</c:Vevent>
</c:component>
</xsl:if>
</xsl:template>
<!-- ... and todos. -->
−
<xsl:template match="*[contains(concat(' ', normalize-space(@class), ' '),' vtodo ')]">
−
<xsl:if test="not($Anchor) or @id = $Anchor">
−
<c:component>
−
<c:Vtodo>
<xsl:call-template name="cal-props"/>
</c:Vtodo>
</c:component>
</xsl:if>
</xsl:template>
−
<xsl:template name="cal-props">
<!-- make a UID out of the Source URI and the ID -->
−
<xsl:if test="@id and $Source">
−
<xsl:attribute name="r:about">
<xsl:value-of select="concat($Source, "#", @id)"/>
</xsl:attribute>
</xsl:if>
−
<!--
if parent of vevent has class my-events, then $Me
is an attendee.
-->
−
<xsl:if test="contains(concat(' ', normalize-space(../@class), ' '), ' my-events ')">
<c:organizer r:resource="{concat($Source, "#", $Me)}"/>
</xsl:if>
−
<xsl:call-template name="textProp">
<xsl:with-param name="class">uid</xsl:with-param>
</xsl:call-template>
−
<xsl:call-template name="dateProp">
<xsl:with-param name="class">dtstamp</xsl:with-param>
</xsl:call-template>
−
<xsl:call-template name="textProp">
<xsl:with-param name="class">summary</xsl:with-param>
</xsl:call-template>
−
<xsl:call-template name="textProp">
<xsl:with-param name="class">description</xsl:with-param>
</xsl:call-template>
−
<xsl:call-template name="dateProp">
<xsl:with-param name="class">dtstart</xsl:with-param>
</xsl:call-template>
−
<xsl:call-template name="dateProp">
<xsl:with-param name="class">dtend</xsl:with-param>
</xsl:call-template>
−
<xsl:call-template name="durProp">
<xsl:with-param name="class">duration</xsl:with-param>
</xsl:call-template>
−
<xsl:call-template name="refProp">
<xsl:with-param name="class">url</xsl:with-param>
−
<xsl:with-param name="default">
−
<xsl:choose>
−
<xsl:when test="@id">
<xsl:value-of select="concat($Source, "#", @id)"/>
</xsl:when>
−
<xsl:otherwise>
<xsl:value-of select="$Source"/>
</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:call-template>
−
<xsl:call-template name="textProp">
<xsl:with-param name="class">location</xsl:with-param>
</xsl:call-template>
−
<xsl:call-template name="textProp">
<xsl:with-param name="class">status</xsl:with-param>
</xsl:call-template>
−
<xsl:call-template name="floatPairProp">
<xsl:with-param name="class">geo</xsl:with-param>
</xsl:call-template>
−
<xsl:call-template name="recurProp">
<xsl:with-param name="class">rrule</xsl:with-param>
</xsl:call-template>
−
<xsl:call-template name="dateProp">
<xsl:with-param name="class">exdate</xsl:with-param>
</xsl:call-template>
−
<xsl:call-template name="whoProp">
<xsl:with-param name="class">attendee</xsl:with-param>
</xsl:call-template>
</xsl:template>
−
<xsl:template name="textProp">
<xsl:param name="class"/>
−
<xsl:for-each select=".//*[ contains(concat(' ', @class, ' '), concat(' ', $class, ' '))]">
−
......