[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xsl-list
Subject:    Re: [xsl] Fw: How would I create this derived field in XML from different XML fields
From:       "Wolfgang Laun wolfgang.laun () gmail ! com" <xsl-list-service () lists ! mulberrytech ! com
Date:       2014-10-30 6:12:08
Message-ID: 20141030021125.30897 () lists ! mulberrytech ! com
[Download RAW message or body]

Code snippet causing a syntax error:

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

Change this to

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

You have to use quotes (0x22) within apostrophes (0x27) and vice versa.

-W



On 30 October 2014 06:54, Hank Ratzesberger xml@xmlwerks.com <
xsl-list-service@lists.mulberrytech.com> wrote:

>
> What environment do you run this transform in?  i.e. Are you able to pass
> a parameter through a batch file / command line?
>
> This describes inserting scripting in C# and passing the current date as a
> parameter variable, created/formatted in some other scripting language:
>
> http://stackoverflow.com/questions/9394322/xslt-1-0-get-current-datetime
>
> Cheers,
> Hank
>
> On Wed, Oct 29, 2014 at 1:18 PM, Catherine Wilbur cwilbur@uwindsor.ca <
> xsl-list-service@lists.mulberrytech.com> wrote:
>
>> How do I create a variable field in xsl 1.0 called batch number with the
>> following format requirement.  Attempted to code myself - getting error
>>
>> We only have Xsl 1.0 not 2.0 as previously stated.
>>
>> YYYYMMDDHHmmXCUR where
>>         YYYYMMDD is current date - converted to a string field
>>         HH is current hour - converted to a 2 character string field
>>         mm is current minutes -converted to a 2 character string field
>>         X will either be L for Leddy or W for Law depending on the value
>> from <po_line_owner> field  (see below)
>> invoice_list/invoice/invoice_line_list/invoice_line/po_line_info/
>> *po_line_owner*
>>         CUR will be a Currency value of (CDN or USD) and pulled from the
>> invoice_list/invoice/invoice_amount/*currency*
>>
>> What values would I find in the po_line_owner:
>>         <po_line_owner>*Paul Martin Law Library*</po_line_owner>
>>         <po_line_owner>*Leddy Library*</po_line_owner>
>>
>>         Note:  if we find the word Law in po_line_owner then make value
>> of X a "W" otherwise make the X  value an "L"
>
>
>
>> [snip]
>>
> --
> Hank Ratzesberger
> XMLWerks.com
>   XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>
> EasyUnsubscribe <-list/528976> (by
> email <>)
>
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/651070
or by email: xsl-list-unsub@lists.mulberrytech.com
--~--
[Attachment #3 (text/html)]

<div dir="ltr"><div><font face="sans-serif">Code snippet causing a syntax \
error:<br><br>&lt;xsl:variable name=&quot;CurrDateTimeValue&quot; \
select=&quot;format-dateTime(current-dateTime(),&quot;[Y0001][M01][D01][H01][m01]&quot;)&quot;/&gt;</font><br><br></div>Change \
this to <br><div><br><font face="sans-serif">&lt;xsl:variable \
name=&quot;CurrDateTimeValue&quot; \
select=&quot;format-dateTime(current-dateTime(),<br>     \
&#39;[Y0001][M01][D01][H01][m01]&#39;)&quot;/&gt;</font><br><br></div><div>You have \
to use quotes (0x22) within apostrophes (0x27) and vice \
versa.<br><br></div><div>-W<br></div><div><br><br></div></div><div \
class="gmail_extra"><br><div class="gmail_quote">On 30 October 2014 06:54, Hank \
Ratzesberger <a href="mailto:xml@xmlwerks.com">xml@xmlwerks.com</a> <span \
dir="ltr">&lt;<a href="mailto:xsl-list-service@lists.mulberrytech.com" \
target="_blank">xsl-list-service@lists.mulberrytech.com</a>&gt;</span> \
wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px \
#ccc solid;padding-left:1ex"><div dir="ltr"><div><br></div><div>What environment do \
you run this transform in?  i.e. Are you able to pass a parameter through a batch \
file / command line?</div><div><br></div><div>This describes inserting scripting in \
C# and passing the current date as a parameter variable, created/formatted in some \
other scripting language:</div><div><br></div><a \
href="http://stackoverflow.com/questions/9394322/xslt-1-0-get-current-datetime" \
target="_blank">http://stackoverflow.com/questions/9394322/xslt-1-0-get-current-datetime</a><div><br></div><div>Cheers,</div><div>Hank<br><div \
class="gmail_extra"><br><div class="gmail_quote"><span class="">On Wed, Oct 29, 2014 \
at 1:18 PM, Catherine Wilbur <a href="mailto:cwilbur@uwindsor.ca" \
target="_blank">cwilbur@uwindsor.ca</a> <span dir="ltr">&lt;<a \
href="mailto:xsl-list-service@lists.mulberrytech.com" \
target="_blank">xsl-list-service@lists.mulberrytech.com</a>&gt;</span> \
wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span><font \
face="sans-serif">How do I create a variable field in xsl 1.0 called batch number \
with the following format requirement.  Attempted to code myself - getting \
error</font> <br>
<br></span><font face="sans-serif">We only have Xsl 1.0 not 2.0 as previously
stated.</font>
<br><span>
<br><font face="sans-serif">YYYYMMDDHHmmXCUR where</font>
<br><font face="sans-serif">        YYYYMMDD
is current date - converted to a string field</font>
<br><font face="sans-serif">        HH
is current hour - converted to a 2 character string field</font>
<br><font face="sans-serif">        mm
is current minutes -converted to a 2 character string field</font>
<br><font face="sans-serif">        X
will either be L for Leddy or W for Law depending on the value from \
&lt;po_line_owner&gt; field  (see below) \
invoice_list/invoice/invoice_line_list/invoice_line/po_line_info/<b>po_line_owner</b></font>
 <br><font face="sans-serif">        CUR
will be a Currency value of (CDN or USD) and pulled from the \
invoice_list/invoice/invoice_amount/<b>currency</b></font> <br>
<br><font face="sans-serif">What values would I find in the po_line_owner:</font>
<br><font face="sans-serif">        &lt;po_line_owner&gt;<b>Paul
Martin Law Library</b>&lt;/po_line_owner&gt;</font>
<br><font face="sans-serif">        &lt;po_line_owner&gt;<b>Leddy
Library</b>&lt;/po_line_owner&gt;</font>
<br>
<br><font face="sans-serif">        Note:
 if we find the word Law in po_line_owner then make value of X a &quot;W&quot;
otherwise make the X  value an &quot;L&quot;</font> </span></blockquote><div> \
</div></span><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span>[snip]<span \
class="HOEnZb"><font \
color="#888888"><br></font></span></span></blockquote></div><span \
class="HOEnZb"><font color="#888888">-- <br><div>Hank \
Ratzesberger<div>XMLWerks.com</div></div> </font></span></div></div></div><div \
class="HOEnZb"><div class="h5"> <div>
<div style="border-top:1px solid \
black;background-color:#dddddd;color:#888888;font-size:smaller;padding:5px;text-align: \
center;font-family:arial,verdana,arial,sans-serif;margin-top:1em;clear:both;margin:auto">
 <a href="http://www.mulberrytech.com/xsl/xsl-list" target="_blank">
XSL-List info and archive</a>
<div style="text-align:center">
<a style="color:blue" href="-list/528976" target="_blank">EasyUnsubscribe</a>
(<a style="color:blue" href="" target="_blank">by email</a>)
</div>
</div>
</div></div></div></blockquote></div><br></div>
<div><!-- begin bl.html.trailer -->
<div style="border-top:1px solid black; background-color: #dddddd;
color: #888888; font-size: smaller; padding: 5px; text-align: center;
font-family: arial,verdana,arial,sans-serif; margin-top:1em; clear:
both; margin: auto">
<a href="http://www.mulberrytech.com/xsl/xsl-list">
XSL-List info and archive</a>
<div style="text-align:center;">
<a style="color: blue;"
  href="http://lists.mulberrytech.com/unsub/xsl-list/651070"
> EasyUnsubscribe</a>
(<a style="color: blue;"
href="mailto:xsl-list-unsub@lists.mulberrytech.com?subject=remove"
> by email</a>)
</div>
</div>
<!-- end bl.html.trailer --></div>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic