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

RE: Problem with converting to XSLT 2.0

Subject: RE: Problem with converting to XSLT 2.0
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 2 Mar 2005 21:30:17 -0000
xmlns fn
After some trivial corrections to your stylesheet (like the unfinished
<xsl:template match="/"> template) I'm getting the output

 
  CFCK  DPARK  slots.t11  pots.t11
 
which looks right.

I think you're hitting bugs in the processor rather than language problems
with XSLT 2.0. Given that you seem to be using a processor that allows  

href="..\text\text.justify.xslt"

in a place where the spec requires a URI, I don't think you're using Saxon.

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


> -----Original Message-----
> From: Heckel, Matt , Ctr, OSD-PA&E 
> [mailto:Matthew.Heckel.ctr@xxxxxxx] 
> Sent: 02 March 2005 20:38
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Problem with converting to XSLT 2.0
> 
> Classification: UNCLASSIFIED
> 
> Hi,
> 
> I've managed to turn a seemingly simple task into a major 
> time kill.  All I
> wanted to do was convert my template to version 2.0 (from 
> version 1.0) to
> take advantage of its nifty grouping functionality.  But no.. 
> after nailing
> the complicated grouping stuff, I ran into a problem using a 
> simple utility
> template, text.justify.xslt,  from Sal Mangano's Cookbook 
> that worked fine
> in V. 1.0.  From what I've observed, the <xsl:choose> element in
> text.justify.xslt is now acting more like an <xsl:if> 
> element.  That is, all
> of the <when> conditions are being tested for, including 
> <otherwise>, even
> though the first test of the group is true.  I should be 
> getting the one
> data element in my source file but instead I'm getting the 
> string "INVALID
> ALIGN" printed out after each attribute.
> 
> I'm not sure if my problem lies with the new <sequence> 
> element for choose
> (doubt it) or something to do with XSLT V. 2.0 only allowing 
> 1 node being
> used in value-of calls as opposed to a nodeset which was ok 
> in V. 1.0.  I
> think this is an ez one for someone other then my newbie self.  MUCH
> appreciation~  Matt
> 
> Source Doc:
>  <?xml version="1.0" encoding="UTF-8" ?> 
> <CASTDataset> 
> <ETL_KV_1 BLUE_THTR_CMD_NM="CFCK" KV_POT_FILE_NM="pots.t11"
> KV_SLOT_FILE_NM="slots.t11" RED_THTR_CMD_NM="DPARK" THTR_ID="1" /> 
> </CASTDataset>
> Main Template:
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="2.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
> 	xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:fn="http://www.w3.org/2004/07/xpath-functions"
> 	xmlns:xdt="http://www.w3.org/2004/07/xpath-datatypes">
> 	<xsl:output method="text" version="1.0" encoding="UTF-8"
> indent="yes"/>
> 	<xsl:include href="..\text\text.justify.xslt"/>
> 	<xsl:variable name="endline" select="'&#x0a;'"/>
> 	<xsl:template match="/">
> 	<xsl:template match="CASTDataset/ETL_KV_1">
> 		<xsl:call-template name="text_justify">
> 			<xsl:with-param name="value" select="concat('
> ',@BLUE_THTR_CMD_NM)"/>
> 			<xsl:with-param name="width" select="14"/>
> 			<xsl:with-param name="align" select=" 'left' "/>
> 		</xsl:call-template>
> 		<xsl:text>  </xsl:text>
> 		<xsl:call-template name="text_justify">
> 			<xsl:with-param name="value" select="concat('
> ',@RED_THTR_CMD_NM)"/>
> 			<xsl:with-param name="width" select="12"/>
> 			<xsl:with-param name="align" select=" 'left' "/>
> 		</xsl:call-template>
> 		<xsl:text>  </xsl:text>
> 		<xsl:call-template name="text_justify">
> 			<xsl:with-param name="value" select="concat('
> ',@KV_SLOT_FILE_NM)"/>
> 			<xsl:with-param name="width" select="30"/>
> 			<xsl:with-param name="align" select=" 'left' "/>
> 		</xsl:call-template>
> 		<xsl:text>  </xsl:text>
> 		<xsl:call-template name="text_justify">
> 			<xsl:with-param name="value" select="concat('
> ',@KV_POT_FILE_NM)"/>
> 			<xsl:with-param name="width" select="30"/>
> 			<xsl:with-param name="align" select=" 'left' "/>
> 		</xsl:call-template>
> 		<xsl:value-of select="$endline"/>
> 	</xsl:template>	
> </xsl:stylesheet>
> 
> Utility Template:  (I've abbreviated the code from the Cookbook for
> readability)
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <!--<xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>   xmlns:str="http://www.ora.com/XSLTCookbook/namespaces/strings"
>   xmlns:text="http://www.ora.com/XSLTCookbook/namespaces/text"
> extension-element-prefixes="text">   -->
>   <xsl:stylesheet version="2.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:fn="http://www.w3.org/2004/07/xpath-functions"
> xmlns:text="http://www.ora.com/XSLTCookbook/namespaces/text"
> extension-element-prefixes="text">
> 
> <xsl:template name="text_justify">
>   <xsl:param name="value" /> 
>   <xsl:param name="width" select="10"/>
>   <xsl:param name="align" select=" 'left' "/>
>   <xsl:variable name="output" select="substring($value,1,$width)"/>
>   <xsl:choose>
>     <xsl:when test="$align = 'left'">
>       <xsl:value-of select="$output"/>
>     </xsl:when>
>     <xsl:when test="$align = 'right'">
>       <xsl:value-of select="$output"/>
>     </xsl:when>
>     <xsl:when test="$align = 'center'">
>       <xsl:value-of select="$output"/>
>     </xsl:when>
>     <xsl:otherwise>INVALID ALIGN</xsl:otherwise>
>   </xsl:choose>
> </xsl:template>
> </xsl:stylesheet>

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.