Skip to content

Commit

Permalink
INTERNAL CHANGE: new representation for "owned" domains vs. scopes, a…
Browse files Browse the repository at this point in the history
…nd new representation of primary scope.
  • Loading branch information
iay committed Nov 30, 2010
1 parent cdbb10f commit 9e6b23d
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 5 deletions.
2 changes: 2 additions & 0 deletions attic/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This folder holds items for which we have no current use, but which we feel
might be useful again (perhaps as templates) in the future.
78 changes: 78 additions & 0 deletions attic/members_domains.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
members_domains.xsl
Update members.xml to use Domain and PrimaryScope instead of
Scopes and isPrimary.
Author: Ian A. Young <ian@iay.org.uk>
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:members="http://ukfederation.org.uk/2007/01/members"
xmlns:xalan="http://xml.apache.org/xalan"

exclude-result-prefixes="members xalan"
xmlns="http://ukfederation.org.uk/2007/01/members"
>

<xsl:output omit-xml-declaration="no" method="xml" encoding="UTF-8"
indent="yes" xalan:indent-amount="4"
/>

<!--
If a Scopes element has an isPrimary Scope, extract that
as the domain and primary scope for the member.
The result may not be schema-valid if the Scopes element is not
the first one belonging to the member: duplicate Domains elements
need to be removed, and misplaced Domains elements may need
to be moved around manually.
-->
<xsl:template match="members:Scopes[members:Scope/@isPrimary='true']">
<xsl:variable name="prdom" select="members:Scope[@isPrimary='true']"/>
<xsl:element name="Domains">
<xsl:text>&#10; </xsl:text>
<xsl:element name="Domain"><xsl:value-of select="$prdom"/></xsl:element>
<xsl:text>&#10; </xsl:text>
</xsl:element>
<xsl:text>&#10; </xsl:text>
<xsl:element name="PrimaryScope"><xsl:value-of select="$prdom"/></xsl:element>
<!--
Delete the Scopes element entirely if:
* it contains only one Scope, and
* it contains no Entity elements
In other words, retain it if:
* it contains more than one Scope, or
* it contains any Entity elements
-->
<xsl:if test="count(members:Scope)>1 or count(members:Entity)!=0">
<xsl:text>&#10; </xsl:text>
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>

<!--
Remove any remaining isPrimary attributes.
-->
<xsl:template match="@isPrimary">
<!-- do nothing -->
</xsl:template>

<!--By default, copy text blocks, comments and attributes unchanged.-->
<xsl:template match="text()|comment()|@*">
<xsl:copy/>
</xsl:template>

<!--By default, copy all elements from the input to the output, along with their attributes and contents.-->
<xsl:template match="*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>

</xsl:stylesheet>
9 changes: 4 additions & 5 deletions build/statistics.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -898,12 +898,11 @@
<th align="left">Primary Scope</th>
<th align="left">Member</th>
</tr>
<xsl:variable name="membersWithScopes"
select="$members[descendant::members:Scope[@isPrimary='true']]"/>
<xsl:variable name="membersWithScopes" select="$members[members:PrimaryScope]"/>
<xsl:for-each select="$membersWithScopes">
<xsl:sort select="descendant::members:Scope[@isPrimary='true'][position()=1]"/>
<xsl:sort select="members:PrimaryScope"/>
<tr>
<td><code><xsl:value-of select="descendant::members:Scope[@isPrimary='true'][position()=1]"/></code></td>
<td><code><xsl:value-of select="members:PrimaryScope"/></code></td>
<td><xsl:value-of select="md:OrganizationName"/></td>
</tr>
</xsl:for-each>
Expand Down Expand Up @@ -947,7 +946,7 @@
<xsl:param name="entities"/>
<xsl:variable name="myName" select="string(md:OrganizationName)"/>
<xsl:variable name="matched" select="$entities[md:Organization/md:OrganizationName = $myName]"/>
<xsl:variable name="primaryScope" select="members:Scopes/members:Scope[@isPrimary='true'][position()=1]"/>
<xsl:variable name="primaryScope" select="members:PrimaryScope"/>
<tr>
<td><xsl:value-of select="$myName"/></td>
<!-- count total entities -->
Expand Down

0 comments on commit 9e6b23d

Please sign in to comment.