XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
simon mcleanSubject: 2 copies of stylus behaving differently ? XSLT 2.0
Author: simon mclean
Date: 18 Jan 2007 08:59 AM
Hi - I've built a style sheet that runs perfectly on stylus on my PC. When a colleague opens it in stylus on their PC it doesn't work. The sheet is XSLT 2.0 and we are both using Saxon 8.7.3.

However, if my colleague puts xpath-default-namespace=... in the opening <xsl:stylsheet> element then the stylsheet works on thier PC, but not on mine!!

Any ideas what is wrong?

I've pasted the xslt in below.

Simon

<?xml version='1.0' ?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xpath-default-namespace="http://www.opentravel.org/OTA/2003/05/beta">
<xsl:template match="/">
<HotelAvailRS>
<xsl:if test="not(OTA_HotelAvailRS/Success)">
<xsl:for-each select="OTA_HotelAvailRS/Errors/Error">
<Error>
<xsl:attribute name="Code">
<xsl:value-of select="@Code"/>
</xsl:attribute>
<xsl:attribute name="ShortText">
<xsl:value-of select="@ShortText"/>
</xsl:attribute>
</Error>
</xsl:for-each>
</xsl:if>
<xsl:if test="OTA_HotelAvailRS/Success">
<xsl:for-each-group select="OTA_HotelAvailRS/RoomStays/RoomStay" group-by="BasicPropertyInfo/@HotelCode">
<HotelAvail>
<Channel>AHT</Channel>
<PropertyID>
<xsl:value-of select="BasicPropertyInfo/@HotelCode"/>
</PropertyID>
<RelativeDistance>
<xsl:value-of select="BasicPropertyInfo/RelativePosition/@Distance"/>
</RelativeDistance>
<xsl:for-each select="current-group()">
<xsl:apply-templates select="OTA_HotelAvailRS/RoomStays/RoomStay"/>
</xsl:for-each>
</HotelAvail>
</xsl:for-each-group>
</xsl:if>
</HotelAvailRS>
</xsl:template>
<xsl:template match="RoomStay">
<RoomStay>
<RoomTypeCode>
<xsl:value-of select="RoomRates/RoomRate/@RoomTypeCode"/>
</RoomTypeCode>
<Total>
<xsl:value-of select="Total/@AmountAfterTax"/>
</Total>
<NumberOfUnits>
<xsl:value-of select="RoomRates/RoomRate/@NumberOfUnits"/>
</NumberOfUnits>
<RoomType>
<xsl:value-of select="RoomTypes/RoomType/RoomDescription/@Name"/>
</RoomType>
<CurrencyCode>
<xsl:value-of select="Total/@CurrencyCode"/>
</CurrencyCode>
</RoomStay>
</xsl:template>
</xsl:stylesheet>

Postnext
Tony LavinioSubject: 2 copies of stylus behaving differently ? XSLT 2.0
Author: Tony Lavinio
Date: 18 Jan 2007 11:11 AM
Are you sure you're input documents are the same?
Check both machines carefully.

Also, in addition to posting the XSLT, it would help
to see the XML.

Postnext
simon mcleanSubject: 2 copies of stylus behaving differently ? XSLT 2.0
Author: simon mclean
Date: 19 Jan 2007 03:09 AM
Originally Posted: 19 Jan 2007 02:56 AM
I've attached the XSLT (slight changes to previous, but same strange behaviour), plus the source and target XML doc. To recap: The attched will NOT run on my stylus studio using Saxon 8.7.3, but it will run on my colleagues stylus studio.

Any help appreciated.

Thanks, Simon


DocumentHotelAvailRS.xml
Target XML doc

DocumentAHT_HotelAvailRS.xml
Source XML doc

DocumentAHT_HotelAvailRS(1).xslt
XSLT

Postnext
(Deleted User) Subject: 2 copies of stylus behaving differently ? XSLT 2.0
Author: (Deleted User)
Date: 19 Jan 2007 04:15 AM
Hi Simon,
the XSLT stylesheet specifies xpath-default-namespace="http://www.opentravel.org/OTA/2003/05/beta" that defines a default namespace for every XPath query, but your XML document doesn't place any element in that namespace.
So I guess that one of you two has a source XML file having an xmlns="http://www.opentravel.org/OTA/2003/05/beta" attribute on the root OTA_HotelAvailRS element.

Hope this helps,
Alberto

Postnext
simon mcleanSubject: 2 copies of stylus behaving differently ? XSLT 2.0
Author: simon mclean
Date: 19 Jan 2007 10:59 AM
Hi Alberto -

I am sure you are correct, but we definitely have one copy of stylus that is taking the sources attached to my post and processing them succesfully (which is, as you suggest, actually incorrect because the source xml doesn't have any elements in the declared default namespace). Strange.

We've decided not to use the xpath-default-namespace attribute now, and instead specify prefixes right the way through. Feels a bit safer being explicit.

Thanks again.

Simon

Posttop
Joe RobeSubject: 2 copies of stylus behaving differently ? XSLT 2.0
Author: Joe Robe
Date: 12 Apr 2007 11:17 AM
Hi Simon,

I am also working with OTA. Since the specs leave many questions open, I am always happy to share information with other OTA users.

Can you please contact me at joer00 at gmail dot com .

Thanks

Joe

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.