| 55 | | <xsl:template name="processGrpAndCats"> |
|---|
| 56 | | <xsl:param name="list" /> |
|---|
| 57 | | <xsl:variable name="group" select="substring-before($list, '~')" /> |
|---|
| 58 | | <xsl:variable name="remaining" select="substring-after($list, '~')" /> |
|---|
| 59 | | <xsl:call-template name="processCategories"> |
|---|
| 60 | | <xsl:with-param name="group" select="$group" /> |
|---|
| 61 | | <xsl:with-param name="list" select="$remaining" /> |
|---|
| | 54 | <xsl:template name="preprocessCats"> |
|---|
| | 55 | <xsl:param name="allCats" /> |
|---|
| | 56 | <xsl:variable name="andCat" select="substring-before($allCats, '~')" /> |
|---|
| | 57 | <xsl:variable name="orList" select="substring-after($allCats, '~')" /> |
|---|
| | 58 | <xsl:call-template name="processCats"> |
|---|
| | 59 | <xsl:with-param name="andCat" select="$andCat" /> |
|---|
| | 60 | <xsl:with-param name="orList" select="$orList" /> |
|---|
| 69 | | <xsl:when test="contains($list, '~')"> |
|---|
| 70 | | <!-- Grab the first off the list and process --> |
|---|
| 71 | | <xsl:variable name="catid" select="substring-before($list, '~')" /> |
|---|
| 72 | | <xsl:variable name="remaining" select="substring-after($list, '~')" /> |
|---|
| 73 | | <xsl:choose> |
|---|
| 74 | | <xsl:when test="$group = 'all'"> |
|---|
| 75 | | <xsl:apply-templates select="event[categories/category/id = $catid]" /> |
|---|
| 76 | | </xsl:when> |
|---|
| 77 | | <xsl:otherwise> |
|---|
| 78 | | <xsl:apply-templates select="event[categories/category/id = $catid]" /> |
|---|
| 79 | | </xsl:otherwise> |
|---|
| 80 | | </xsl:choose> |
|---|
| 81 | | |
|---|
| 82 | | <!-- now use recursion to process the remaining categories --> |
|---|
| 83 | | <xsl:call-template name="processCategories"> |
|---|
| 84 | | <xsl:with-param name="list" select="$remaining" /> |
|---|
| 85 | | </xsl:call-template> |
|---|
| 86 | | </xsl:when> |
|---|
| 87 | | <xsl:otherwise> |
|---|
| 88 | | <!-- No more tildes, so this is the last category. Process it --> |
|---|
| 89 | | <xsl:choose> |
|---|
| 90 | | <xsl:when test="$group = 'all'"> |
|---|
| 91 | | <xsl:choose> |
|---|
| 92 | | <xsl:when test="$list = 'all'"> |
|---|
| 93 | | <xsl:apply-templates select="event" /> |
|---|
| 94 | | </xsl:when> |
|---|
| 95 | | <xsl:otherwise> |
|---|
| 96 | | <xsl:apply-templates select="event[categories/category/id = $list]" /> |
|---|
| | 68 | |
|---|
| | 69 | <xsl:when test="contains($orList, '~')"> |
|---|
| | 70 | <!-- There are 2 or more on the "or" list. --> |
|---|
| | 71 | <xsl:variable name="orCat" select="substring-before($orList, '~')" /> |
|---|
| | 72 | <xsl:variable name="remainingOrList" select="substring-after($orList, '~')" /> |
|---|
| | 73 | <!-- Process the first one --> |
|---|
| | 74 | <xsl:call-template name="processAndOr"> |
|---|
| | 75 | <xsl:with-param name="andCat" select="$andCat"/> |
|---|
| | 76 | <xsl:with-param name="orCat" select="$orCat"/> |
|---|
| | 77 | </xsl:call-template> |
|---|
| | 78 | <!-- and use recursion to process the remaining categories --> |
|---|
| | 79 | <xsl:call-template name="processCats"> |
|---|
| | 80 | <xsl:with-param name="andCat" select="$andCat"/> |
|---|
| | 81 | <xsl:with-param name="orList" select="$remainingOrList" /> |
|---|
| | 82 | </xsl:call-template> |
|---|
| | 83 | </xsl:when> |
|---|
| | 84 | |
|---|
| | 85 | <xsl:otherwise> |
|---|
| | 86 | <!-- No more tildes, so this is the last or only "or" category. Call processAndOr to process it --> |
|---|
| | 87 | <xsl:call-template name="processAndOr"> |
|---|
| | 88 | <xsl:with-param name="andCat" select="$andCat"/> |
|---|
| | 89 | <xsl:with-param name="orCat" select="$orList"/> |
|---|
| | 90 | </xsl:call-template> |
|---|
| | 91 | </xsl:otherwise> |
|---|
| | 92 | |
|---|
| | 93 | </xsl:choose> |
|---|
| | 94 | </xsl:template> |
|---|
| | 95 | |
|---|
| | 96 | <xsl:template name="processAndOr"> |
|---|
| | 97 | <xsl:param name="andCat"/> |
|---|
| | 98 | <xsl:param name="orCat" /> |
|---|
| | 99 | <xsl:choose> |
|---|
| | 100 | <xsl:when test="$andCat = 'all'"> |
|---|
| | 101 | <xsl:choose> |
|---|
| | 102 | <xsl:when test="$orCat = 'all'"> |
|---|
| | 103 | <!-- all categories should be displayed --> |
|---|
| | 104 | <xsl:apply-templates select="event" /> |
|---|
| | 105 | </xsl:when> |
|---|
| | 106 | <xsl:otherwise> |
|---|
| | 107 | <!-- nothing being anded; display event if it matches "or" category--> |
|---|
| | 108 | <xsl:apply-templates select="event[categories/category/uid = $orCat]" /> |
|---|