p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

xslt thread: functions that return nodesets


Message #1 by "Rich" <rpcee@o...> on Tue, 17 Sep 2002 21:01:25
Yes, please send me the source: the first thing I need to do is to see
if I can reproduce the effect.

Michael Kay
Software AG
home: Michael.H.Kay@n...
work: Michael.Kay@s... 


> -----Original Message-----
> From: rich [mailto:rpcee@o...] 
> Sent: 23 September 2002 12:31
> To: P2P_XSLT
> Subject: [xslt] Re: functions that return nodesets
> 
> 
> Here's the stylesheet. The test source is generated from 
> Visio and is about 100K zipped, would you like me to send it 
> to you direct? I'm running using the command line (java 
> net.sf.saxon.Transform for saxon 7, and java 
> com.icl.saxon.StyleSheet for saxon 6), so I don't know if 
> parsing or other factors are the cause.
> 
> 
> <?xml version="1.0" encoding="UTF-8" ?>
> 
> <xsl:stylesheet version="1.0"
>       xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>       xmlns:xalan="http://xml.apache.org/xalan"
>       exclude-result-prefixes="xalan"
>       xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> 
>    <xsl:output method="xml" indent="yes"/>
> 
>    <xsl:key name="classdef" match="Foundation.Core.Class" 
> use="@xmi.id"/>
>    <xsl:key name="gendef" match="Foundation.Core.Generalization"
> use="@xmi.id"/>
> 
>    <xsl:template match="/XMI">
>       <xsd:schema>
>          <xsl:apply-templates 
> select="XMI.content//Model_Management.Package/Foundation.Core.
> Namespace.owne
> dElement/Foundation.Core.Class"/>
>       </xsd:schema>
>    </xsl:template>
> 
>    <!-- complex type and element from class -->
> 
>    <xsl:template match="Foundation.Core.Class">
> 
>       <xsl:variable name="classname" 
> select="Foundation.Core.ModelElement.name"/>
> 
>       <xsl:if test="$classname">
>          <xsd:element>
>             <xsl:attribute name="name">
>                <xsl:value-of 
> select="Foundation.Core.ModelElement.name"/>
>             </xsl:attribute>
>             <xsd:complexType>
>                <xsd:complexContent>
>                   <xsl:variable name="superclass" 
> select="key('classdef', key('gendef', 
> Foundation.Core.GeneralizableElement.generalization/Foundation
> .Core.Generali
> zation/@xmi.idref)/Foundation.Core.Generalization.supertype/Fo
> undation.Core.
> Class/@xmi.idref)/Foundation.Core.ModelElement.name"/>
>                   <xsl:if test="$superclass">
>                      <xsd:extension>
>                         <xsl:attribute name="base">
>                            <xsl:value-of select="$superclass"/>
>                         </xsl:attribute>
>                         <xsl:if 
> test="Foundation.Core.Classifier.feature/Foundation.Core.Attribute">
>                            <xsd:sequence>
>                               <xsl:apply-templates 
> select="Foundation.Core.Classifier.feature/Foundation.Core.Att
> ribute"/>
>                            </xsd:sequence>
>                         </xsl:if>
>                      </xsd:extension>
>                   </xsl:if>
>                </xsd:complexContent>
>             </xsd:complexType>
>          </xsd:element>
>       </xsl:if>
>    </xsl:template>
> 
> </xsl:stylesheet>
> 
> 
> > If the same stylesheet runs that much slower, I'd certainly like to 
> > take a look at it so I can understand why.
> >
> > Michael Kay
> > Software AG
> > home: Michael.H.Kay@n...
> > work: Michael.Kay@s...
> >
> >
> >
> 
> 
> 
> ---
> In developing the .NET Framework Microsoft has 
> taken XML to heart, and with ASP.NET representing 
> the cutting edge of Windows based web development, 
> Professional ASP.NET XML with C# has been published 
> to help web developers to appreciate how these 
> technologies can work together to provide 
> functional, powerful applications. 
> http://www.wrox.com/acon11.asp?ISBN=1861007345
> 


  Return to Index