How to get the content of the tag that references idref in xml

vicksanj

New Member
I'm trying to get the name of the selecao that are playing, like in the I want to get the name of the PAIS from the IDREF s1, that it is Franca.The consult in the xpath: //id(@pais) and returns Franca and Senegal, OK, these two are the only one that have IDREF pais.But I put this expression in the xsl and doesn't work. Someone knows where is the error?Here are my codes: XML\[code\] <?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="file:///C:/Users/Cesar%20Frantz/Desktop/XML/trabalhoxml.xsl"?><Bolaocopa xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file:///C:/Users/Cesar%20Frantz/Desktop/exemplo.xsd"> <grupos> <grupo tipo="A"> <pais id="s1">Franca</pais> <pais id="s2">Senegal</pais> <pais id="s3">Uruguai</pais> <pais id="s4">Dinamarca</pais> </grupo> </grupos> <jogos> <faseGrupos> <jogoGrupo id="a"> <jogo numero="1"> <selecao pais="s1">0</selecao> <selecao pais="s2">1</selecao> </jogo> </jogoGrupo> </faseGrupos> </jogos></Bolaocopa>\[/code\]XSL:\[code\] <?xml version="1.0" encoding="ISO-8859-1"?><xsl:stylesheet version="2.0"xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:template match="/"> <html> <body><xsl:value-of select="//id(@pais)"/> </body> </html></xsl:template></xsl:stylesheet>\[/code\]SCHEMA:\[code\]<?xml version="1.0" encoding="UTF-8"?><!-- edited with XMLSpy v2013 sp1 (x64) (http://www.altova.com) by Cesar (UNIFRA - Franciscan University Center) --><!--W3C Schema generated by XMLSpy v2013 sp1 (x64) (http://www.altova.com)--><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:simpleType name="ST_selecao"> <xs:restriction base="xs:int"> <xs:enumeration value="http://stackoverflow.com/questions/14537659/0"/> <xs:enumeration value="http://stackoverflow.com/questions/14537659/1"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="ST_pais"> <xs:restriction base="xs:string"> <xs:enumeration value="http://stackoverflow.com/questions/14537659/Dinamarca"/> <xs:enumeration value="http://stackoverflow.com/questions/14537659/Franca"/> <xs:enumeration value="http://stackoverflow.com/questions/14537659/Senegal"/> <xs:enumeration value="http://stackoverflow.com/questions/14537659/Uruguai"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="AT_6"> <xs:restriction base="xs:string"> <xs:enumeration value="http://stackoverflow.com/questions/14537659/s1"/> <xs:enumeration value="http://stackoverflow.com/questions/14537659/s2"/> <xs:enumeration value="http://stackoverflow.com/questions/14537659/s3"/> <xs:enumeration value="http://stackoverflow.com/questions/14537659/s4"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="AT_5"> <xs:restriction base="xs:string"> <xs:enumeration value="http://stackoverflow.com/questions/14537659/A"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="AT_3"> <xs:restriction base="xs:string"> <xs:enumeration value="http://stackoverflow.com/questions/14537659/s1"/> <xs:enumeration value="http://stackoverflow.com/questions/14537659/s2"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="AT_2"> <xs:restriction base="xs:int"> <xs:enumeration value="http://stackoverflow.com/questions/14537659/1"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="AT_1"> <xs:restriction base="xs:string"> <xs:enumeration vhttp://stackoverflow.com/questions/14537659/alue="a"/> </xs:restriction> </xs:simpleType> <xs:complexType name="T_selecao"> <xs:simpleContent> <xs:extension base="ST_selecao"> <xs:attribute ref="pais"/> </xs:extension> </xs:simpleContent> </xs:complexType> <xs:complexType name="T_pais"> <xs:simpleContent> <xs:extension base="ST_pais"> <xs:attribute name="id" type="xs:ID" use="required"/> </xs:extension> </xs:simpleContent> </xs:complexType> <xs:complexType name="T_jogos"> <xs:sequence> <xs:element ref="faseGrupos"/> </xs:sequence> </xs:complexType> <xs:complexType name="T_jogoGrupo"> <xs:sequence> <xs:element ref="jogo"/> </xs:sequence> <xs:attribute name="id" type="AT_1" use="required"/> </xs:complexType> <xs:complexType name="T_jogo"> <xs:sequence> <xs:element ref="selecao" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute ref="numero" use="required"/> </xs:complexType> <xs:complexType name="T_grupos"> <xs:sequence> <xs:element ref="grupo"/> </xs:sequence> </xs:complexType> <xs:complexType name="T_grupo"> <xs:sequence> <xs:element ref="pais" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute ref="tipo" use="required"/> </xs:complexType> <xs:complexType name="T_faseGrupos"> <xs:sequence> <xs:element ref="jogoGrupo"/> </xs:sequence> </xs:complexType> <xs:complexType name="T_Bolaocopa"> <xs:sequence> <xs:element ref="grupos"/> <xs:element ref="jogos"/> </xs:sequence> </xs:complexType> <xs:attribute name="tipo" type="AT_5"/> <xs:attribute name="pais" type="xs:IDREF"/> <xs:attribute name="numero" type="AT_2"/> <xs:element name="selecao" type="T_selecao"/> <xs:element name="pais" type="T_pais"/> <xs:element name="jogos" type="T_jogos"/> <xs:element name="jogoGrupo" type="T_jogoGrupo"/> <xs:element name="jogo" type="T_jogo"/> <xs:element name="grupos" type="T_grupos"/> <xs:element name="grupo" type="T_grupo"/> <xs:element name="faseGrupos" type="T_faseGrupos"/> <xs:element name="Bolaocopa" type="T_Bolaocopa"/></xs:schema>\[/code\]
 
Back
Top