Output from document() is not formatted

Here should go questions about transforming XML with XSLT and FOP.
Posts: 1
Joined: Fri Aug 10, 2018 7:08 am

Output from document() is not formatted

Post by pvibhute » Fri Aug 10, 2018 7:22 am

Hello All,

I am new to XSLT & looking for the way to get formatted result from xslt.
Basically, I am invoking simple REST API through xslt as below -

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
<xsl:template match="/">
<xsl:variable name="REST_response2"
select="document('http://localhost:8800/wmshead_fwh_django/wms/lgfapi/v9/entity/facility/647/facility_time_zone')" />
<xsl:value-of select="$REST_response2" />
Output I see is - 111Asia/Kolkata

If I run the same API through Postman, I return as below -

Code: Select all

"result_count": 1,
"page_count": 1,
"page_nbr": 1,
"next_page": null,
"previous_page": null,
"results": [
"code": "Asia/Kolkata"
I have another question about passing authentication, not sure its relevant here but any thought/guideline will be helpful.
Query is, while executing this API through xslt. Is there any way, we can pass user/password on API through xslt ?

Posts: 6914
Joined: Fri Jul 09, 2004 5:18 pm

Re: Output from document() is not formatted

Post by Radu » Fri Aug 10, 2018 8:11 am


Maybe instead of xsl:value-of you should use "xsl:copy-of" instead, otherwise all the XML tags will be stripped from the copied content.
About the authentication, maybe it would be better to do that outside of the XSLT, have an ANT build file which downloads the necessary XML document from the web using authentication, then it stores it locally and invokes the XSLT stylesheet which reads the local XML and processes it.

Radu Coravu
<oXygen/> XML Editor

Post Reply