xsl-list
[Top] [All Lists]

Re: [xsl] 1 XSL for 2 XML

2004-06-03 03:13:09
Found answer, but ...
Is it possible to use     exclude-result-prefixes="f"  ????
It doesn't work for me.

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:f="urn:schemas-cp-com:gen">
<xsl:output method="html" version="4.0"/>

<xsl:template match="/">
<html><body>
<xsl:apply-templates select="//*[local-name(.)='MYTAB']"/>
</body></html>
</xsl:template>

<xsl:template match="*[local-name(.)='MYTAB']">
<table border="1">
<th>HEAD</th>
<th><xsl:value-of select="MYHEAD"/><xsl:value-of select="f:MYHEAD"/></th>
<xsl:apply-templates select="*[local-name(.)='MYITEM']"/>
</table>
</xsl:template>

<xsl:template match="*[local-name(.)='MYITEM']">
<tr><td>ITEM</td>
<td><xsl:value-of select="MYIT"/><xsl:value-of select="f:MYIT"/></td></tr>
</xsl:template>
</xsl:stylesheet>



Hi,
I need a little help. I have 2 XML and 2 XSL to view files in IE,
but I need only 1 XSL. Only SOAP header and namespaces is difference
between XML files.
Any help?
...
2. XML:
<?xml version="1.0"?>
<?xml-stylesheet type='text/xsl' href='soap_mytab.xsl'?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";>
  <soap:Header>
  </soap:Header>
  <soap:Body>
    <receivedocument xmlns="urn:schemas-cp-com:loc">
      <BodyDocuments>
      <MYTAB xmlns="urn:schemas-cp-com:gen">
       <MYHEAD>AAA</MYHEAD>
       <MYITEM>
          <MYIT>A1</MYIT>
       </MYITEM>
       <MYITEM>
          <MYIT>A2</MYIT>
       </MYITEM>
      </MYTAB>
      </BodyDocuments>
    </receivedocument>
  </soap:Body>
</soap:Envelope>
2.XSL soap_mytab.xsl:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";
xmlns:d="urn:schemas-cp-com:loc"
xmlns:f="urn:schemas-cp-com:gen">
<xsl:output method="html" version="4.0"/>
<xsl:template match="/">
<html><body>
<xsl:apply-templates 
select="soap:Envelope/soap:Body/d:receivedocument/d:BodyDocuments/f:MYTAB"/>
</body></html>
</xsl:template>
<xsl:template match="f:MYTAB">
<table border="1">
<th>HEAD</th><th><xsl:value-of select="f:MYHEAD"/></th>
<xsl:apply-templates select="f:MYITEM"/>
</table>
</xsl:template>
<xsl:template match="f:MYITEM">
<tr><td>ITEM</td><td><xsl:value-of select="f:MYIT"/></td></tr>
</xsl:template>
</xsl:stylesheet>


____________________________________________________________
Konečně tě vidím barevně. SAMSUNG X450 již od 2577 Kč. www.oskar.cz
http://ad.seznam.cz/clickthru?spotId=74859


<Prev in Thread] Current Thread [Next in Thread>