Re: [basex-talk] BaseX XSLT fails after returning first result

2020-05-21 Thread Furst, Thomas
Yes and no. It was mentioned to me earlier today when posting on SO. I know 
some XQuery, but not so much as I do XSLT. This current output is not the final 
transformation, there is quite a bit more to go, this was just early test and 
ran into this issue. I am open to ideas on how to do this best. I am going to 
explore the pure XQuery rout this afternoon.

From: Christian Grün 
Sent: Thursday, May 21, 2020 12:47 PM
To: Furst, Thomas 
Cc: BaseX 
Subject: Re: [basex-talk] BaseX XSLT fails after returning first result

Your query might be much slicker and more efficient if you wrote it completely 
in XQuery. Did you think about that?



Furst, Thomas mailto:thomas.fu...@rcmt.com>> schrieb am 
Do., 21. Mai 2020, 17:22:
I have a large XML file stored in BaseX that I need to split up into smaller, 
modular documents. I have created an XSL file to do so:
http://www.w3.org/1999/XSL/Transform<https://urldefense.proofpoint.com/v2/url?u=http-3A__www.w3.org_1999_XSL_Transform=DwMFaQ=viCaR4syck-m-tzQNjsSRw=8cnUIumRCVK6Z3gJMHR1Kn5-ebe8_mBZSOMSTe0VW6g=Ll7Y3KdNGxWUAIcEUMl5-1KY_qGlqo7vNWurWUdXaNg=dGWTAzmmlqT9rIopjDqnJYqt5w9iaiHmKv7ZEJKUjKo=>"

xmlns:xs="http://www.w3.org/2001/XMLSchema<https://urldefense.proofpoint.com/v2/url?u=http-3A__www.w3.org_2001_XMLSchema=DwMFaQ=viCaR4syck-m-tzQNjsSRw=8cnUIumRCVK6Z3gJMHR1Kn5-ebe8_mBZSOMSTe0VW6g=Ll7Y3KdNGxWUAIcEUMl5-1KY_qGlqo7vNWurWUdXaNg=TMtkIh2P0153JDizacD-8WspDgmhLCT4IZuMS87Uymc=>"
exclude-result-prefixes="xs"
version="2.0">












































My issue is that when using the xslt:transform() function in BaseX it only 
returns (creates) the first document. This is the XQuery I have for this:
let $style := doc('file:///C:/base.xsl')

   for $d in doc('file:///C:/Users/tfurst/Documents/Book1-test.xml')//title
  for $newD in //*[title]
  where $newD/title/@id eq $d/@id
let $schema := $d/schemaName
let $model := $d/modelic
let $sdc := $d/sdc
let $sys := $d/systemCode
let $subsys := $d/subsys
let $subsubsys := $d/subsubsys
let $assy := $d/assy
let $disassy := $d/disassy
let $disassyv := $d/disassyv
let $info := $d/infoCode
let $infov := $d/infov
let $itemloc := $d/itemloc
let $tname := $d/tname
let $iname := $d/iname
return xslt:transform($newD,$style, map 
{"outputDir":"file:///G:/LMA-Conv/Flight/test-conv-out", "model":$model, 
"sysDiff":$sdc, "sys":$sys, "subsys":$subsys, "subsubsys":$subsubsys, 
"assy":$assy, "disassy":$disassy, "disassyv":$disassyv, "info":$info, 
"infov":$infov, "itemloc":$itemloc, "tname":$tname, "iname":$iname})

The document named Book1-test.xml is essentially a map of existing IDs of 
elements to new output file names. After it creates the first XML output file 
BaseX returns ERROR [FODC0002] "" (Line 1): Premature end of file. When I 
looked up the error code in the BaseX documentation this error is defined as 
"The specified document resource cannot be retrieved. ". Is there some 
limitation to the use of the xslt:transform function in a loop? I am not 
understanding why it was able to retrieved the first time, but not after that. 
I have tried to move the XSL to different file locations, no luck. Am I missing 
something ridiculously obvious here? This XSL stylesheet is a very simplified 
version of what it will ultimately become, I wanted to get the process down 
before fully developing the XSL.

Thank you,

Tom Furst
NOTE: This email message and any attachments are for the sole use of the 
intended recipient(s) and may contain confidential and/or privileged 
information. Any unauthorized review, use, disclosure or distribution is 
prohibited. If you are not the intended recipient, please contact the sender by 
replying to this email, and destroy all copies of the original message. Thank 
you, RCM Technologies.<https://www.rcmt.com>

NOTE: This email message and any attachments are for the sole use of the 
intended recipient(s) and may contain confidential and/or privileged 
information. Any unauthorized review, use, disclosure or distri

Re: [basex-talk] BaseX XSLT fails after returning first result

2020-05-21 Thread Christian Grün
Your query might be much slicker and more efficient if you wrote it
completely in XQuery. Did you think about that?



Furst, Thomas  schrieb am Do., 21. Mai 2020, 17:22:

> I have a large XML file stored in BaseX that I need to split up into
> smaller, modular documents. I have created an XSL file to do so:
>
> http://www.w3.org/1999/XSL/Transform;
>
> xmlns:xs="http://www.w3.org/2001/XMLSchema;
>
> exclude-result-prefixes="xs"
>
> version="2.0">
>
> 
>
> 
>
> 
>
> 
>
> 
>
> 
>
> 
>
> 
>
> 
>
> 
>
> 
>
> 
>
> 
>
> 
>
> 
>
> 
>
>
>
> 
>
>  method="xml">
>
> 
>
> 
>
> 
>
> 
>
>  systemDiffCode="{$sysDiff}">
>
>  select="$sys"/>
>
>  select="$subsys"/>
>
>  select="$subsubsys"/>
>
>  select="$assy"/>
>
>  select="$disassy"/>
>
>  select="$disassyv"/>
>
>  select="$info"/>
>
>  select="$infov"/>
>
>  select="$itemloc"/>
>
> 
>
>  countryIsoCode="US"/>
>
> 
>
> 
>
> 
>
> 
>
> 
>
> 
>
> 
>
> 
>
>
>
> My issue is that when using the xslt:transform() function in BaseX it only
> returns (creates) the first document. This is the XQuery I have for this:
>
> let $style := doc('file:///C:/base.xsl')
>
>
>
>for $d in doc('file:///C:/Users/tfurst/Documents/Book1-test.xml')//title
>
>   for $newD in //*[title]
>
>   where $newD/title/@id eq $d/@id
>
> let $schema := $d/schemaName
>
> let $model := $d/modelic
>
> let $sdc := $d/sdc
>
> let $sys := $d/systemCode
>
> let $subsys := $d/subsys
>
> let $subsubsys := $d/subsubsys
>
> let $assy := $d/assy
>
> let $disassy := $d/disassy
>
> let $disassyv := $d/disassyv
>
> let $info := $d/infoCode
>
> let $infov := $d/infov
>
> let $itemloc := $d/itemloc
>
> let $tname := $d/tname
>
> let $iname := $d/iname
>
> return xslt:transform($newD,$style, map {"outputDir":"
> file:///G:/LMA-Conv/Flight/test-conv-out", "model":$model,
> "sysDiff":$sdc, "sys":$sys, "subsys":$subsys, "subsubsys":$subsubsys,
> "assy":$assy, "disassy":$disassy, "disassyv":$disassyv, "info":$info,
> "infov":$infov, "itemloc":$itemloc, "tname":$tname, "iname":$iname})
>
>
>
> The document named Book1-test.xml is essentially a map of existing IDs of
> elements to new output file names. After it creates the first XML output
> file BaseX returns ERROR [FODC0002] "" (Line 1): Premature end of file.
> When I looked up the error code in the BaseX documentation this error is
> defined as *"The specified document resource cannot be retrieved. "*. Is
> there some limitation to the use of the xslt:transform function in a loop?
> I am not understanding why it was able to retrieved the first time, but not
> after that. I have tried to move the XSL to different file locations, no
> luck. Am I missing something ridiculously obvious here? This XSL stylesheet
> is a very simplified version of what it will ultimately become, I wanted to
> get the process down before fully developing the XSL.
>
>
>
> Thank you,
>
>
>
> Tom Furst
>
> NOTE: This email message and any attachments are for the sole use of the
> intended recipient(s) and may contain confidential and/or privileged
> information. Any unauthorized review, use, disclosure or distribution is
> prohibited. If you are not the intended recipient, please contact the
> sender by replying to this email, and destroy all copies of the original
> message. Thank you, RCM Technologies. 
>
>
> NOTE: This email message and any attachments are for the sole use of the
> intended recipient(s) and may contain confidential and/or privileged
> information. Any unauthorized review, use, disclosure or distribution is
> prohibited. If you are not the intended recipient, please contact the
> sender by replying to this email, and destroy all copies of the original
> message. Thank you, RCM Technologies. 
>


Re: [basex-talk] BaseX XSLT fails after returning first result

2020-05-21 Thread Imsieke, Gerrit, le-tex
Alternatively, apply your stylesheet using xslt:transform-text() instead 
of xslt:transform().


On 21.05.2020 18:33, Imsieke, Gerrit, le-tex wrote:

Hi Tom,

The problem is most probably that your XSLT doesn’t create a *primary* 
output. It just writes something to another result-document. However, 
the interface for invoking an XSLT expects some result document. So if 
you just create a  element next to  and 
then discard it, it should just work.


Gerrit



Re: [basex-talk] BaseX XSLT fails after returning first result

2020-05-21 Thread Imsieke, Gerrit, le-tex

Hi Tom,

The problem is most probably that your XSLT doesn’t create a *primary* 
output. It just writes something to another result-document. However, 
the interface for invoking an XSLT expects some result document. So if 
you just create a  element next to  and 
then discard it, it should just work.


Gerrit

On 21.05.2020 17:22, Furst, Thomas wrote:
I have a large XML file stored in BaseX that I need to split up into 
smaller, modular documents. I have created an XSL file to do so:


http://www.w3.org/1999/XSL/Transform;

     xmlns:xs="http://www.w3.org/2001/XMLSchema;

     exclude-result-prefixes="xs"

     version="2.0">

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     method="xml">


     

     

     

     

     systemDiffCode="{$sysDiff}">


     select="$sys"/>


     select="$subsys"/>


     select="$subsubsys"/>


     select="$assy"/>


     select="$disassy"/>


     name="disassyCodeVariant" select="$disassyv"/>


     select="$info"/>


     select="$infov"/>


     select="$itemloc"/>


     

     countryIsoCode="US"/>


     

     

     

     

     

     

 



My issue is that when using the xslt:transform() function in BaseX it 
only returns (creates) the first document. This is the XQuery I have for 
this:


let $style := doc('file:///C:/base.xsl')

    for $d in doc('file:///C:/Users/tfurst/Documents/Book1-test.xml')//title

   for $newD in //*[title]

   where $newD/title/@id eq $d/@id

     let $schema := $d/schemaName

     let $model := $d/modelic

     let $sdc := $d/sdc

     let $sys := $d/systemCode

     let $subsys := $d/subsys

     let $subsubsys := $d/subsubsys

     let $assy := $d/assy

     let $disassy := $d/disassy

     let $disassyv := $d/disassyv

     let $info := $d/infoCode

     let $infov := $d/infov

     let $itemloc := $d/itemloc

     let $tname := $d/tname

     let $iname := $d/iname

     return xslt:transform($newD,$style, map 
{"outputDir":"file:///G:/LMA-Conv/Flight/test-conv-out", "model":$model, 
"sysDiff":$sdc, "sys":$sys, "subsys":$subsys, "subsubsys":$subsubsys, 
"assy":$assy, "disassy":$disassy, "disassyv":$disassyv, "info":$info, 
"infov":$infov, "itemloc":$itemloc, "tname":$tname, "iname":$iname})


The document named Book1-test.xml is essentially a map of existing IDs 
of elements to new output file names. After it creates the first XML 
output file BaseX returns ERROR [FODC0002] "" (Line 1): Premature end of 
file. When I looked up the error code in the BaseX documentation this 
error is defined as *"The specified document resource cannot be 
retrieved. "*. Is there some limitation to the use of the xslt:transform 
function in a loop? I am not understanding why it was able to retrieved 
the first time, but not after that. I have tried to move the XSL to 
different file locations, no luck. Am I missing something ridiculously 
obvious here? This XSL stylesheet is a very simplified version of what 
it will ultimately become, I wanted to get the process down before fully 
developing the XSL.


Thank you,

Tom Furst