XML isnt showing basic text from XSL document
Here should go questions about transforming XML with XSLT and FOP.
XML isnt showing basic text from XSL document
Hi all,
Newbie here so sorry if this is a basic question, basically I have an XML that wont link to my XSL stylesheet, this is what is at the top of my XML document
The XSL stylesheet is contained within the same folder and is called TransformDocument.xsl, which looks like this
I am not getting testing123 displaying anywhere when I open the XML file, I dont think its linking because I also just put testing123 in the <body> tags and still nothing was displayed - I have tried this in Chrome and Edge.
Newbie here so sorry if this is a basic question, basically I have an XML that wont link to my XSL stylesheet, this is what is at the top of my XML document
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="TransformDocument.xsl"?>
<root>
<listing>
<seller_info>
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3org1999/XSL/Transform">
<xsl:template match="/">
<html>
<head></head>
<body>
<xsl:apply-templates select="/root/listing"/>
</body>
</html>
</xsl:template>
<xsl:template match="listing">
Testing123
</xsl:template>
</xsl:stylesheet>
Re: XML isnt showing basic text from XSL document
Hi,
The namespace declaration of your XSLT should be:
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
Other than that maybe web browsers no longer interpret "xml-stylesheet" instructions when loading XML documents. Maybe you need to use Javascript to apply the XSLT.
Regards,
Radu
The namespace declaration of your XSLT should be:
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
Other than that maybe web browsers no longer interpret "xml-stylesheet" instructions when loading XML documents. Maybe you need to use Javascript to apply the XSLT.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 38
- Joined: Thu Jul 29, 2021 12:02 pm
Re: XML isnt showing basic text from XSL document
Post by InspectorSpacetime »
Hi,
In addition to the namespace issue Radu mentioned:
Modern browsers don't allow XML files to access local XSLT files due to security concerns. More info can be found here:
https://stackoverflow.com/questions/455 ... gle-chrome
So, if your trying to check the transformation with local files in a web browser, it probably will not work anyway. The solution is to use a local host or an XML editor.
In addition to the namespace issue Radu mentioned:
Modern browsers don't allow XML files to access local XSLT files due to security concerns. More info can be found here:
https://stackoverflow.com/questions/455 ... gle-chrome
So, if your trying to check the transformation with local files in a web browser, it probably will not work anyway. The solution is to use a local host or an XML editor.
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service