ropensci / xslt

Extension of xml2 package for xsl transformations
https://docs.ropensci.org/xslt
28 stars 1 forks source link

xpath document() #3

Open oggioniale opened 6 years ago

oggioniale commented 6 years ago

I am trying to transform an XML file through the use of an XSLT so as to obtain a CSV through the use of xml_xslt () with these commands:

library(xslt)
library(xml2)

xmlNid <- as.character(8164)
xslObs.url <- "http://www.get-it.it/objects/sensors/xslt/EMF2CSVObs.xsl"
xmlObs <- paste0("https://data.lter-europe.net/deims/node/", xmlNid,"/emf")
style <- read_xml(xslObs.url, package = "xslt")
doc <- read_xml(xmlObs, package = "xslt")
outputCsv <- xml_xslt(doc, style)

The result are the following with warnings:

Title;TitleURL;Metadata;MetadataURL;GetData;GetDataURL\n
;https://data.lter-europe.net/deims/node/8932;ISO19139 (GMD);https://data.lter-europe.net/deims/node/8932/iso19139;Other data type;\n
;https://data.lter-europe.net/deims/node/8881;ISO19139 (GMD);https://data.lter-europe.net/deims/node/8881/iso19139;Other data type;\n
;https://data.lter-europe.net/deims/node/8882;ISO19139 (GMD);https://data.lter-europe.net/deims/node/8882/iso19139;Other data type;\n

Warning messages:
1: In doc_xslt_apply(doc$doc, stylesheet$doc, paramstr) :
  failed to load external entity "https://data.lter-europe.net/deims/node/8932/iso19139" [1549]
2: In doc_xslt_apply(doc$doc, stylesheet$doc, paramstr) :
  failed to load external entity "https://data.lter-europe.net/deims/node/8932/iso19139" [1549]
3: In doc_xslt_apply(doc$doc, stylesheet$doc, paramstr) :
  failed to load external entity "https://data.lter-europe.net/deims/node/8881/iso19139" [1549]
4: In doc_xslt_apply(doc$doc, stylesheet$doc, paramstr) :
  failed to load external entity "https://data.lter-europe.net/deims/node/8881/iso19139" [1549]
5: In doc_xslt_apply(doc$doc, stylesheet$doc, paramstr) :
  failed to load external entity "https://data.lter-europe.net/deims/node/8882/iso19139" [1549]
6: In doc_xslt_apply(doc$doc, stylesheet$doc, paramstr) :
  failed to load external entity "https://data.lter-europe.net/deims/node/8882/iso19139" [1549]

I have also tested XSLT on oXygen and the result is this:

Title;TitleURL;Metadata;MetadataURL;GetData;GetDataURL
Biovolume of Phytoplankton in Lake Maggiore site code IT_SI001137_within the period 1981-2010;https://data.lter-europe.net/deims/node/8932;ISO19139 (GMD);https://data.lter-europe.net/deims/node/8932/iso19139;Other data type;ftp://KU2253_2@ftp.umweltbundesamt.at/KnownUsers/2253_2/EnvEurope_DataCollection/
IT_SI001137_airTEMP 250513 Data on air temperature in Lake Maggiore 2011-2012;https://data.lter-europe.net/deims/node/8881;ISO19139 (GMD);https://data.lter-europe.net/deims/node/8881/iso19139;Other data type;ftp://KU2253_2@ftp.umweltbundesamt.at/KnownUsers/2253_2/EnvEurope_DataCollection/
IT_SI001137_PREC 250513 Data on precipitation in Lake Maggiore 2011-2012;https://data.lter-europe.net/deims/node/8882;ISO19139 (GMD);https://data.lter-europe.net/deims/node/8882/iso19139;Other data type;ftp://KU2253_2@ftp.umweltbundesamt.at/KnownUsers/2253_2/EnvEurope_DataCollection/

Could be a problem about HTTPS connection? Any other solution?

Best regards Alessandro