[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Matching elements based on element type:

Subject: RE: Matching elements based on element type:
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Mon, 17 Jul 2006 17:36:46 +0100
xs element type
> Is XSLT2.0 fully supported by any products (any free software 
> products?)?

XSLT 2.0 is now a W3C Candidate Recommendation, which means it's in the
final QA stages. The current work is focusing on testing interoperability of
implementations. I'm aware of five implementations, of which two have not
yet been released, but I think it's fair to say that Saxon has by far the
largest market share.

The open source Saxon-B processor does not provide the schema-aware
facilities; for that you have to pay for the commercial Saxon-SA product.
It's only GBP 250, so you've paid for it as soon as it saves a day of your
time.

> It feels kind of risky to use a standard that hasn't even 
> been finalized by the w3c yet...

Attitudes to risk vary. The Saxon XSLT 2.0 processor is being used in some
very big applications, for example several investment banks are using it. I
guess that's because investment bankers are accustomed to taking risks and
profiting when they pay off.

Michael Kay
http://www.saxonica.com/


> 
> Regards,
> David
> 
> 
> 2006/7/17, Michael Kay <mike@xxxxxxxxxxxx>:
> >
> > You write
> >
> > <xsl:template match="element(*, my_type)">
> >
> > and use a schema-aware XSLT 2.0 processor.
> >
> > Michael Kay
> > http://www.saxonica.com/
> >
> >
> >
> > > -----Original Message-----
> > > From: David B [mailto:daavidb@xxxxxxxxx]
> > > Sent: 17 July 2006 16:57
> > > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > > Subject:  Matching elements based on element type:
> > >
> > > Hello,
> > >
> > > I have an xml file that looks like this:
> > >
> > > <top>
> > >     <a>123</a>
> > >     <b>456</b>
> > >     <c>789</c>
> > > </top>
> > >
> > >
> > > And has a schema as follows:
> > > <?xml version="1.0" encoding="UTF-8"?> <xs:schema 
> > > xmlns:xs="http://www.w3.org/2001/XMLSchema">
> > >     <xs:element name="top">
> > >         <xs:complexType>
> > >             <xs:sequence>
> > >                 <xs:element name="a" type="my_type"/>
> > >                 <xs:element name="b" type="my_type"/>
> > >                 <xs:element name="c" type="my_type"/>
> > >             </xs:sequence>
> > >         </xs:complexType>
> > >     </xs:element>
> > >     <xs:simpleType name="my_type">
> > >         <xs:restriction base="xs:string"/>
> > >     </xs:simpleType>
> > > </xs:schema>
> > >
> > > That is, the elements a,b,c all have the type my_type but have 
> > > different element names.
> > >
> > > I want an xslt stylesheet that has a single template for all 
> > > elements of type my_type. Something like:
> > > <xsl:template match="top">
> > >     <xsl:apply-templates/>
> > > </xsl:template>
> > >
> > > <xsl:template match="*[type()=my_type]">
> > >      <xsl:value-of select="."/>
> > > </xsl:template>
> > >
> > > Only there is no type() function in XPath....
> > >
> > > Is there any other way I could do this?
> > >
> > > Best Regards,
> > > David Belius

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.