Advertisement
Guest User

Untitled

a guest
May 29th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 2.22 KB | None | 0 0
  1. <?xml version="1.0" encoding="utf-8"?>
  2.  <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  3.    <xsl:template match="//DISTRITO">
  4.       {
  5.         "codigo": <xsl:value-of select="CODIGO" />,
  6.         "nome": "<xsl:value-of select="NOME" />",
  7.         "regiao": "<xsl:value-of select="REGIAO" />",
  8.          "partipacao":{
  9.                           "inscritos": <xsl:value-of select="INSCRITOS" />,
  10.                           "votantes": <xsl:value-of select="VOTANTES" />,
  11.                           "abstencoes": <xsl:value-of select="ABSTENCOES" />,
  12.                           "brancos": <xsl:value-of select="BRANCOS" />,
  13.                           "nulos": <xsl:value-of select="NULOS" />
  14.                       },
  15.       "resultados": [
  16.       <xsl:for-each select="./RESULTADOS/RESULTADOS_ROW">
  17.         {
  18.          "mandatos": "<xsl:value-of select="MANDATOS" />",
  19.          "partido": "<xsl:value-of select="DESIGNACAO" />",
  20.          "votos": "<xsl:value-of select="VOTOS" />"
  21.         },
  22.       </xsl:for-each>
  23.       ],
  24.       "concelhos": [
  25.       <xsl:for-each select="./CONCELHOS/CONCELHOS_ROW">
  26.         {
  27.           "codigo": "<xsl:value-of select="CODIGO" />",
  28.           "nome": "<xsl:value-of select="NOME" />",
  29.           "resultados": [
  30.           <xsl:for-each select="./RESULTADOSCONCELHO/RESULTADOSCONCELHO_ROW">
  31.             {
  32.              "partido": "<xsl:value-of select="DESIGNACAO" />",
  33.              "votos": "<xsl:value-of select="VOTOS" />"
  34.             },
  35.           </xsl:for-each>
  36.           ],
  37.           "freguesias": [
  38.             <xsl:for-each select="./FREGUESIAS/FREGUESIAS_ROW">
  39.             {
  40.               "codigo": "<xsl:value-of select="CODIGO" />",
  41.               "nome": "<xsl:value-of select="NOME" />",
  42.               "resultados": [
  43.               <xsl:for-each select="./RESULTADOSFREGUESIA/RESULTADOSFREGUESIA_ROW">
  44.                 {
  45.                  "partido": "<xsl:value-of select="DESIGNACAO" />",
  46.                  "votos": "<xsl:value-of select="VOTOS" />"
  47.                 },
  48.               </xsl:for-each>
  49.               ]
  50.             },
  51.           </xsl:for-each>
  52.           ]
  53.         },
  54.       </xsl:for-each>
  55.       ]
  56.       },
  57.    </xsl:template>
  58. </xsl:stylesheet>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement