public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] gentoo commit in xml/htdocs/xsl: mirrors.xsl
@ 2008-01-17 21:52 Xavier Neys (neysx)
  0 siblings, 0 replies; 4+ messages in thread
From: Xavier Neys (neysx) @ 2008-01-17 21:52 UTC (permalink / raw
  To: gentoo-commits

neysx       08/01/17 21:52:14

  Added:                mirrors.xsl
  Log:
  Add support for MirrorsXML

Revision  Changes    Path
1.1                  xml/htdocs/xsl/mirrors.xsl

file : http://sources.gentoo.org/viewcvs.py/gentoo/xml/htdocs/xsl/mirrors.xsl?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo/xml/htdocs/xsl/mirrors.xsl?rev=1.1&content-type=text/plain

Index: mirrors.xsl
===================================================================
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
                xmlns:exslt="http://exslt.org/common"
                xmlns:str="http://exslt.org/strings"
                extension-element-prefixes="str exslt">

<xsl:output     omit-xml-declaration="yes"
                indent="yes"
                cdata-section-elements="description"/>

<xsl:param name="mode"/>

<xsl:key name="country" match="/mirrors/countries/country" use="@code"/>

<xsl:strip-space elements="*"/>

<!-- Identity transform, just copy everything -->
<xsl:template match="/ | mirrors | /mirrors//* | mainpage | mainpage//* | @*">
 <xsl:copy>
  <xsl:apply-templates select="@*"/>
  <xsl:apply-templates/>
 </xsl:copy>
</xsl:template>

<xsl:template match="@country">
  <xsl:attribute name="country">
   <xsl:value-of select="."/>
  </xsl:attribute>
  <xsl:attribute name="countryname">
   <xsl:value-of select="key('country', .)"/>
  </xsl:attribute>
</xsl:template>

<xsl:template match="/mirrors/countries"/> <!-- Leave'em behind -->


<xsl:template match="/mainpage//mirrorlist">
 <!-- Generate list of mirrors, when (inside a mainpage && @select='full')
                                  || (inside a     body && @select='partial') -->
 <xsl:variable name="the-mirrors" select="document('/main/en/mirrors3.xml')"/>

 <xsl:choose>
  <xsl:when test="name(..)='mainpage' and @select='full'">
   <xsl:for-each select="$the-mirrors//mirrorgroup">
    <xsl:variable name="r" select="@region"/>
    <xsl:if test="count(preceding-sibling::mirrorgroup[@region=$r])=0">
      <chapter id="{str:encode-uri(translate($r, ' ', ''),true())}">
        <title>
         <xsl:value-of select="@region"/>
        </title>
         <xsl:for-each select="$the-mirrors//mirrorgroup[@region=$r]">
         <xsl:sort select="key('country', @country)"/>
          <xsl:if test="mirror[uri[contains('nN',@partial)]]">
            <xsl:variable name="c" select="@country"/>
            <xsl:variable name="n" select="key('country', @country)"/>
            <section id="{str:encode-uri(translate($n, ' ', ''),true())}">
              <title>
                <xsl:value-of select="$n"/>
              </title>
              <body>
              <p>
               <xsl:for-each select="mirror[uri[contains('nN',@partial)]]">
               <xsl:sort select="translate(name,'qwertyuiopasdfghjklzxcvbnm','QWERTYUIOPASDFGHJKLZXCVBNM')"/>
                 <xsl:apply-templates select="uri[contains('nN',@partial)]" mode="mirror"/>
               </xsl:for-each>
              </p>
              </body>
            </section>
          </xsl:if>
         </xsl:for-each>
      </chapter>
    </xsl:if>
   </xsl:for-each>
  </xsl:when>
  <xsl:when test="name(..)='body' and @select='partial'">
   <xsl:for-each select="$the-mirrors//mirror[uri[contains('yY',@partial)]]">
   <xsl:sort select="translate(name,'qwertyuiopasdfghjklzxcvbnm','QWERTYUIOPASDFGHJKLZXCVBNM')"/>
     <xsl:apply-templates select="uri[contains('Yy',@partial)]" mode="mirror"/>
   </xsl:for-each>
  </xsl:when>
 </xsl:choose>
</xsl:template>

<xsl:template match="uri" mode="mirror">
  <uri link="{.}">
    <xsl:choose>
    <xsl:when test="contains('yY', @partial)">
      <xsl:value-of select="concat(preceding-sibling::name, ' (', key('country', ../../@country) , '/', @protocol, ')')"/>
    </xsl:when>
    <xsl:when test="contains('nN', @partial)">
      <xsl:value-of select="concat(preceding-sibling::name, ' (', @protocol, ')')"/>
    </xsl:when>
    </xsl:choose>
    <xsl:if test="contains('yY', @ipv6)">
     <xsl:text>*</xsl:text>
    </xsl:if>
  </uri>
  <br/>
</xsl:template>

</xsl:stylesheet>



-- 
gentoo-commits@lists.gentoo.org mailing list



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [gentoo-commits] gentoo commit in xml/htdocs/xsl: mirrors.xsl
@ 2008-01-17 22:02 Xavier Neys (neysx)
  0 siblings, 0 replies; 4+ messages in thread
From: Xavier Neys (neysx) @ 2008-01-17 22:02 UTC (permalink / raw
  To: gentoo-commits

neysx       08/01/17 22:02:00

  Modified:             mirrors.xsl
  Log:
  Take care of 1-country regions

Revision  Changes    Path
1.2                  xml/htdocs/xsl/mirrors.xsl

file : http://sources.gentoo.org/viewcvs.py/gentoo/xml/htdocs/xsl/mirrors.xsl?rev=1.2&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo/xml/htdocs/xsl/mirrors.xsl?rev=1.2&content-type=text/plain
diff : http://sources.gentoo.org/viewcvs.py/gentoo/xml/htdocs/xsl/mirrors.xsl?r1=1.1&r2=1.2

Index: mirrors.xsl
===================================================================
RCS file: /var/cvsroot/gentoo/xml/htdocs/xsl/mirrors.xsl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- mirrors.xsl	17 Jan 2008 21:52:14 -0000	1.1
+++ mirrors.xsl	17 Jan 2008 22:02:00 -0000	1.2
@@ -54,9 +54,11 @@
             <xsl:variable name="c" select="@country"/>
             <xsl:variable name="n" select="key('country', @country)"/>
             <section id="{str:encode-uri(translate($n, ' ', ''),true())}">
-              <title>
+              <xsl:if test="count($the-mirrors//mirrorgroup[@region=$r])>1 or not($n=$r)">
+               <title>
                 <xsl:value-of select="$n"/>
-              </title>
+               </title>
+              </xsl:if>
               <body>
               <p>
                <xsl:for-each select="mirror[uri[contains('nN',@partial)]]">



-- 
gentoo-commits@lists.gentoo.org mailing list



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [gentoo-commits] gentoo commit in xml/htdocs/xsl: mirrors.xsl
@ 2008-01-17 23:05 Xavier Neys (neysx)
  0 siblings, 0 replies; 4+ messages in thread
From: Xavier Neys (neysx) @ 2008-01-17 23:05 UTC (permalink / raw
  To: gentoo-commits

neysx       08/01/17 23:05:42

  Modified:             mirrors.xsl
  Log:
  Add "ipv6 only" where applicable

Revision  Changes    Path
1.3                  xml/htdocs/xsl/mirrors.xsl

file : http://sources.gentoo.org/viewcvs.py/gentoo/xml/htdocs/xsl/mirrors.xsl?rev=1.3&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo/xml/htdocs/xsl/mirrors.xsl?rev=1.3&content-type=text/plain
diff : http://sources.gentoo.org/viewcvs.py/gentoo/xml/htdocs/xsl/mirrors.xsl?r1=1.2&r2=1.3

Index: mirrors.xsl
===================================================================
RCS file: /var/cvsroot/gentoo/xml/htdocs/xsl/mirrors.xsl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- mirrors.xsl	17 Jan 2008 22:02:00 -0000	1.2
+++ mirrors.xsl	17 Jan 2008 23:05:41 -0000	1.3
@@ -85,15 +85,20 @@
 
 <xsl:template match="uri" mode="mirror">
   <uri link="{.}">
+    <xsl:variable name="ipv6-only">
+     <xsl:if test="contains('nN', @ipv4) and contains('yY', @ipv6)">
+      <xsl:text>/ipv6 only</xsl:text>
+     </xsl:if>
+    </xsl:variable>
     <xsl:choose>
     <xsl:when test="contains('yY', @partial)">
-      <xsl:value-of select="concat(preceding-sibling::name, ' (', key('country', ../../@country) , '/', @protocol, ')')"/>
+      <xsl:value-of select="concat(preceding-sibling::name, ' (', key('country', ../../@country) , '/', @protocol, $ipv6-only, ')')"/>
     </xsl:when>
     <xsl:when test="contains('nN', @partial)">
-      <xsl:value-of select="concat(preceding-sibling::name, ' (', @protocol, ')')"/>
+      <xsl:value-of select="concat(preceding-sibling::name, ' (', @protocol, $ipv6-only, ')')"/>
     </xsl:when>
     </xsl:choose>
-    <xsl:if test="contains('yY', @ipv6)">
+    <xsl:if test="contains('yY', @ipv4) and contains('yY', @ipv6)">
      <xsl:text>*</xsl:text>
     </xsl:if>
   </uri>



-- 
gentoo-commits@lists.gentoo.org mailing list



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [gentoo-commits] gentoo commit in xml/htdocs/xsl: mirrors.xsl
@ 2009-12-03  9:11 Robin H. Johnson (robbat2)
  0 siblings, 0 replies; 4+ messages in thread
From: Robin H. Johnson (robbat2) @ 2009-12-03  9:11 UTC (permalink / raw
  To: gentoo-commits

robbat2     09/12/03 09:11:10

  Modified:             mirrors.xsl
  Log:
  Bug #293434: Give the <mirrorlist> element a new argument of the path to the source file to use, so we can reuse some of the template for a new rsync mirrors page.

Revision  Changes    Path
1.4                  xml/htdocs/xsl/mirrors.xsl

file : http://sources.gentoo.org/viewcvs.py/gentoo/xml/htdocs/xsl/mirrors.xsl?rev=1.4&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo/xml/htdocs/xsl/mirrors.xsl?rev=1.4&content-type=text/plain
diff : http://sources.gentoo.org/viewcvs.py/gentoo/xml/htdocs/xsl/mirrors.xsl?r1=1.3&r2=1.4

Index: mirrors.xsl
===================================================================
RCS file: /var/cvsroot/gentoo/xml/htdocs/xsl/mirrors.xsl,v
retrieving revision 1.3
retrieving revision 1.4
diff -p -w -b -B -u -u -r1.3 -r1.4
--- mirrors.xsl	17 Jan 2008 23:05:41 -0000	1.3
+++ mirrors.xsl	3 Dec 2009 09:11:10 -0000	1.4
@@ -35,9 +35,11 @@
 
 
 <xsl:template match="/mainpage//mirrorlist">
- <!-- Generate list of mirrors, when (inside a mainpage && @select='full')
-                                  || (inside a     body && @select='partial') -->
- <xsl:variable name="the-mirrors" select="document('/main/en/mirrors3.xml')"/>
+ <!-- Given a XML file (@src) containing mirrors grouped by country,
+	  generate list of mirrors, when (inside a mainpage && @select='full')
+                                  || (inside a     body && @select='partial') 
+								  -->
+ <xsl:variable name="the-mirrors" select="document(@src)"/>
 
  <xsl:choose>
   <xsl:when test="name(..)='mainpage' and @select='full'">






^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-12-03  9:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-03  9:11 [gentoo-commits] gentoo commit in xml/htdocs/xsl: mirrors.xsl Robin H. Johnson (robbat2)
  -- strict thread matches above, loose matches on Subject: below --
2008-01-17 23:05 Xavier Neys (neysx)
2008-01-17 22:02 Xavier Neys (neysx)
2008-01-17 21:52 Xavier Neys (neysx)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox