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

Re: How would I create this derived field in XML from

Subject: Re: How would I create this derived field in XML from different XML fields
From: "Imsieke, Gerrit, le-tex gerrit.imsieke@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 29 Oct 2014 20:09:37 -0000
Re:  How would I create this derived field in XML from
On 29.10.2014 20:44, Catherine Wilbur cwilbur@xxxxxxxxxxx wrote:
*_Below in my xsl code am getting a syntax error on the following line_*

<xsl:variable name="CurrDateTimeValue"
select="format-dateTime(current-dateTime(),"[Y0001][M01][D01][H01][m01]")"/>

Use single quotes to delimit the picture string when you used double quotes for the select attribute.


select="format-dateTime(current-dateTime(),'[Y0001][M01][D01][H01][m01]')"


Element type "xsl:variable" must be followed by either attribute specifications, ">" or "/>".


b& b&


<xsl:choose> <xsl:when test="contains-case-insensitive($InvoicePOLineOwner, 'Law')"> <xsl:variable name="POOwnerType" select="W'" /> </xsl:when> <xsl:otherwise> <xsl:variable name="POOwnerType" select="L" /> </xsl:otherwise> </xsl:choose>

This wonbt work because
a) the scope of the variable declarations will be limited to the xsl:when and xsl:otherwise branches, respectively. There wonbt be a variable $POOwnerType outside of them.
b) the strings 'W' and 'L' arenbt properly delimited
c) there is no function contains-case-insensitive()


Use this for the variable declaration:

<xsl:variable name="POOwnerType" as="xs:string">
  <xsl:choose>
    <xsl:when test="matches($InvoicePOLineOwner, 'Law', 'i')">
      <xsl:sequence select="'W'"/>
    </xsl:when>
    <xsl:otherwise>
      <xsl:sequence select="'L'"/>
    </xsl:otherwise>
  </xsl:choose>
</xsl:variable>

or shorter

<xsl:variable name="POOwnerType" as="xs:string"
  select="if (matches($InvoicePOLineOwner, 'Law', 'i'))
          then 'W' else 'L'"/>

If you use an editor such as oXygen it will make you aware of all these issues, thanks to the embedded Saxon processor.

Because the XML input lacks essential parts, I was unable to validate the remainder of your XSLTbs functionality. If you want me to check it, you may send me a complete input off-list. Of course you might ask the next question on the list when you encounter the next hurdle. Keep on exploring XSLT 2, itbs totally worth it!

Gerrit

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.