Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: [xsl] 1 XSL for 2 XML

From: "Michael Kay" <mhk@--------->
To:
Date: 6/3/2004 2:08:00 PM
Selecting by local-name like this is not a very good idea, when all you are
trying to do is to avoid specifying a correct namespace prefix. Firstly,
it's selecting/matching elements that it shouldn't (elements in the wrong
namespace). 

Secondly, with Saxon at any rate, it makes the search for a matching
template rule very inefficient. Saxon organizes rules by the node-kind and
node-name of the nodes that are matched, and then looks for "generic" rules
that can match multiple node kinds or multiple node-names. If all the rules
are generic, as here, then it potentially tries to match each element
against every rule.

Michael Kay 

> -----Original Message-----
> From: Petr Mach3 [mailto:Mach3P@xxxxxxxxx] 
> Sent: 03 June 2004 10:13
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re: [xsl] 1 XSL for 2 XML
> 
> 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:BodyDocume
> nts/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&#x10D;n&#x11B; t&#x11B; vid&#xED;m barevn&#x11B;. SAMSUNG X450 ji&#x17E; od 2577 K&#x10D;. www.oskar.cz
> http://ad.seznam.cz/clickthru?spotId=74859
> 
> --+------------------------------------------------------------------
> XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
> or e-mail: <mailto:xsl-list-unsubscribe@xxxxxxxxxxxxxxxxxxxxxx>
> --+--
> 
>


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent