diff --git a/classesphp/wmswfs.php b/classesphp/wmswfs.php
index 1989d9e..947212e 100644
--- a/classesphp/wmswfs.php
+++ b/classesphp/wmswfs.php
@@ -261,10 +261,10 @@ function temaswms()
{
$r = pegaTag($layer);
$retorna = imprimeTag($r,$retorna);
- $query = $q.'/Layer/Layer';
- $layers1 = $xpath->query($query);
+ $layers1 = $xpath->query('Layer',$layer);
foreach ($layers1 as $layer1)
{
+ $layers2 = $xpath->query('Layer',$layer1);
$r1 = pegaTag($layer1);
$camada1 = $r1["nome"];
$titulocamada1 = $r1["titulo"];
@@ -272,12 +272,13 @@ function temaswms()
if($r1["estilos"])
{$retorna = imprimeEstilos($r1["estilos"],$suporta,$retorna,$camada1,$titulocamada1);}
else
- {$retorna[] = " default".$titulocamada1."
";}
-
- $query = $q.'/Layer/Layer/Layer';
- $layers2 = $xpath->query($query);
+ {
+ if($layers2->length == 0)
+ $retorna[] = " default".$titulocamada1."
";
+ }
foreach ($layers2 as $layer2)
{
+ $layers3 = $xpath->query('Layer',$layer2);
$r2 = pegaTag($layer2);
$camada2 = $r2["nome"];
$titulocamada2 = $r2["titulo"];
@@ -285,19 +286,32 @@ function temaswms()
if($r2["estilos"])
{$retorna = imprimeEstilos($r2["estilos"],$suporta,$retorna,$camada2,$titulocamada2);}
else
- {$retorna[] = " default ".$titulocamada2."
";}
-
- }
+ {
+ if($layers3->length == 0)
+ $retorna[] = " default ".$titulocamada2."
";
+ }
+ foreach ($layers3 as $layer3)
+ {
+ $r3 = pegaTag($layer3);
+ $camada3 = $r3["nome"];
+ $titulocamada3 = $r3["titulo"];
+ $retorna = imprimeTag($r3,$retorna);
+ if($r3["estilos"])
+ {$retorna = imprimeEstilos($r3["estilos"],$suporta,$retorna,$camada3,$titulocamada3);}
+ else
+ {
+ $retorna[] = " default ".$titulocamada3."
";
+ }
+ }
+ }
+ if(count($layers2) == 1){$retorna[] = "
"; - //var_dump($retorna); $cp->set_data(implode($retorna)); } function imprimeEstilos($es,$suporta,$retorna,$tval,$tituloalternativo) -- libgit2 0.21.2