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

Inconsistency

Subject: Inconsistency
From: Kamal <kbhatt@xxxxxxxxx>
Date: Sat, 29 Mar 2008 01:25:47 +1100
 Inconsistency
Hi,
I ran the following XSLT and XML in two ways -

Via the xslt ant task (comes with ant 1.7) and through XSLT FOP. I got two very different results. Using the ant task, the key did not work, but using XSLT FOP (which is probably Xalan), I managed to get what I expected. To add to my weirdness, on the Ant task, if I used


<xsl:message><xsl:copy-of select="key('getComponent',1)"/></xsl:message>


instead of


<xsl:message><xsl:copy-of select="key('getComponent', $component_id)"/></xsl:message>


I got the expected result. Something is obviously busted. Is it the xslt ant task?

Also, any thought as to why the contents of the Groups section appears in the fo:layout-master-set?

Thanks.


<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:datetime="http://exslt.org/dates-and-times"
xmlns:str="http://exslt.org/strings" >


<xsl:import href="styling.xslt"/>

<xsl:key name="getComponent" match="/Vouchers/Components/Component" use="@Id"/>

<xsl:variable name="components" select="/Vouchers/Components"/>

<xsl:template match="Vouchers">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<xsl:apply-templates select="Components/Component" mode="page_masters">
</xsl:apply-templates>
</fo:layout-master-set>
</fo:root>
</xsl:template>


 <xsl:template match="Component" mode="page_masters">
   <xsl:apply-templates select="*" mode="page_masters_comp">
     <xsl:with-param name="component_id" select="@Id"/>
   </xsl:apply-templates>
 </xsl:template>

<xsl:template match="HotelStay" mode="page_masters_comp">
<xsl:param name="component_id"/>
<xsl:message><xsl:value-of select="$component_id"/></xsl:message>
<xsl:message><xsl:copy-of select="key('getComponent', $component_id)"/></xsl:message>
<xsl:for-each select="key('getComponent', $component_id)/Groups/Group">
<xsl:variable name="master_name" select="concat('component-', $component_id, '-room-', @Id)"/>
<fo:simple-page-master master-name="$master_name">
<xsl:call-template name="page_definition"/>
<fo:region-body region-name="{$master_name}-body">
<xsl:call-template name="region_body_styling"/>
</fo:region-body>
<fo:region-before region-name="hotel-top">
<xsl:call-template name="region_before_styling"/>
</fo:region-before>
<fo:region-after region-name="voucher-conditions">
<xsl:call-template name="region_after_stying"/>
</fo:region-after>
</fo:simple-page-master> </xsl:for-each>
</xsl:template>


</xsl:stylesheet>

======
XML
======

<Vouchers>
 <Components>
   <Component Id="1">
     <HotelStay>

</HotelStay>
<Groups>
<Group Id="1">
<Description>A room with no view</Description>
<ConfirmationId>KASDF-123</ConfirmationId>
</Group>
<Group Id="2">
<Description>A room with a view</Description>
</Group> </Groups> </Component>
</Components>
</Vouchers>


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.