I have a project which is structured as shown in image. This project sends emails out when reseting passwords. I have a folder XSLT with .xslt files in it. I have header, footer and style in Common folder where as ResetPassword.xslt right under XSLT folder.
ResetPassword.xslt:
<?xml version="1.0"?>
<xsl:include href="Common/Header.xslt"/>
<xsl:output method="html"/>
<xsl:template match="/">
<html>
<head>
<xsl:call-template name="Style"/>
</head>
<body>
<table id="resetPasswordBody">
<tr>
<td>
<xsl:call-template name="Header"/>
As you can see I am calling the Header template from with in ResetPassword.xslt template. In the Header template I have following:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template name="Header">
<img src="img\banner.jpg"/>
</xsl:template>
</xsl:stylesheet>
The problem is when I run this project inside visual studio (by right click -> show in browser) the image does not appear. I am bit struggling to find out what path I can mention inside the header xslt template so that banner.jpg can appear. I have tried every possible combination.
The only path which works is the full path i.e. C:\XXXXXX\xxxxx
But the problem is when deployed on server the full path will not be a valid one.
I am confused and any help will be great.
Thanks in advance.
You are calling the file from template it is 2 up to reach the image
../../img/banner.jpg
or img/banner.jpg
Related
This error,
The processing instruction target matching "[xX][mM][lL]" is not allowed
occurs whenever I run an XSLT page that begins as follows:
<?xml version="1.0" encoding="windows-1256"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:include href="../header.xsl"/>
<xsl:template match="/">
<xsl:call-template name="pstyle"/>
<xsl:call-template name="Validation"/>
<xsl:variable name="strLang">
<xsl:value-of select="//lang"/>
</xsl:variable>
<!-- ////////////// Page Title ///////////// -->
<title>
<xsl:value-of select="//ListStudentFinishedExam.Title"/>
</title>
Note: I removed any leading spaces before the first line, but the error still occurs!
Xerces-based tools will emit the following error
The processing instruction target matching "[xX][mM][lL]" is not allowed.
when an XML declaration is encountered anywhere other than at the top of an XML file.
This is a valid diagnostic message; other XML parsers should issue a similar error message in this situation.
To correct the problem, check the following possibilities:
Some blank space or other visible content exists before the <?xml ?>
declaration.
Resolution: remove blank space or any other
visible content before the XML declaration.
Some invisible content exists before the <?xml ?>
declaration. Most commonly this is a Byte Order Mark
(BOM).
Resolution:
Remove the BOM using techniques such as those suggested by the W3C
page on the BOM in HTML.
A stray <?xml ?> declaration exists within the XML content.
This can happen when XML files are combined programmatically or
via cut-and-paste. There can only be one <?xml ?> declaration
in an XML file, and it can only be at the top.
Resolution: Search for
<?xml in a case-insensitive manner, and remove all but the top XML
declaration from the file.
Debug your XML file. Either there is space or added extra or fewer tags.
For better understanding build the project through the command line. Windows: gradlew build
In my case, AndroidManifest.xml has a blank space at the very first line
<Empty Row> // This Creates the issue
<?xml version="1.0" encoding="utf-8"?>
There was auto generated Copyright message in XML and a blank line before <resources> tag, once I removed it my build was successful.
just remove this line: <?xml version="1.0" encoding="utf-8"?> because this kind of error only come because of this line or you might also check the format of your line according the mentioned line in this answer.
I had a similar issue with 50,000 rdf/xml files in 5,000 directories (the Project Gutenberg catalog file). I solved it with riot (in the jena distribution)
the directory is cache/epub/NN/nn.rdf (where NN is a number)
in the directory above the directory where all the files are, i.e. in cache
riot epub/*/*.rdf --output=turtle > allTurtle.ttl
This produces possibly many warnings but the result is in a format which can be loaded into jena (using the fuseki web interface).
surprisingly simple (at least in this case).
Another reason of the above error is corrupted jar file. I got the same error but for Junit when running unit tests. Removing jar and downloading it again fixed the issue.
in my case was a wrong path in a config file: file was not found (path was wrong) and it came out with this exception:
Error configuring from input stream. Initial cause was The processing
instruction target matching "[xX][mM][lL]" is not allowed.
For PHP, put this line of code before you start printing your XML:
while(ob_get_level()) ob_end_clean();
It's worth checking your server's folders to see if there's a stray pom.xml hanging around.
I found that I had the problem everyone else described with a malformed pom.xml, but in a folder that I didn't expect to be on the server. An old build was sticking around unwelcome D:
For my case, the tab is the trouble maker. Replace the tab with blank should resolve the issue
I'm trying to create an XML file that shows different news articles within an iframe. A shortened version of the news' body is shown as a subtitle (which is already prewritten and chosen with the help of PHP, this isn't the issue) and to show the full body, the idea is to take the user to a link where the full body is shown. The PHP creates a file in the folder 'articles' on the root directory which contains the full body with the folder name as the title (e.g if the title was 'foo' then the xml file would be under: /articles/foo/index.xml (the XSL is already done for that file)).
My idea is to add a link to the XML with the shortened body to the XML page that would link to the file in the articles folder to allow a user to read the whole body. How would I, using the XSL stylesheet, create a link to this XML page with the whole body?
Below is the code for the XML and XSL to be used in the iframe (without the body)
XML code:
...
<articles>
<article>
<title>(This is what I want to be used as a link)</title>
<image></image>
<subtitle></subtitle>
</article>
</articles>
XSL code:
...
<table...>
<xsl:for-each select="articles/article">
<th...><img src="{image}"...></th>
<th...><h1><xsl:value-of select="title" /></h1></th>
</xsl:for-each>
</tr>
<tr>
<xsl:for-each select="articles/article">
<th...><h2><xsl:value-of select="subtitle" /></h2></th>
</xsl:for-each>
</tr>
</table>
...
I'm looking to set the XSL title part to a href to link to the mentioned page. How would I do this?
I figured this out by, in the XSL, doing the following:
...
<th...><h1><xsl:value-of select="title" /></h1></th>
...
For my blog site, I use Node.js, Express, and Jade for templating.
I built a simple rss.jade template for my RSS feed, and am having problems getting the required tag to work nicely.
I believe, in older versions of Jade you could use:
link http://example.com
Now, it is enforcing that 'link' is self-closing like:
link(rel='stylesheet', href='style.css')
Is there any other solution rather than plain-text like:
|<link>http://example.com</link>
Are you sure you defined the right doctype?
With the doctype xml you can produce this example:
doctype xml
rss(version="2.0")
link.
http://example.com
and get the output you wished to see:
<?xml version="1.0" encoding="utf-8" ?>
<rss version="2.0">
<link>http://example.com</link>
</rss>
I'm trying to use the xslt "call-template" directive in my diazo rules, cause I don't want "repeat my self".
But, when I set-up the xsl:template and call it with xsl:call-template in the rules I obtain an exception from the diazo debugger
element template only allowed as child of stylesheet
What's the matter? Can I use the call-tempalte? And if not, how I can don't repeat my self in the xslt templating?
Example:
<?xml version="1.0" encoding="UTF-8"?>
<rules
xmlns="http://namespaces.plone.org/diazo"
xmlns:css="http://namespaces.plone.org/diazo/css"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xi="http://www.w3.org/2001/XInclude">
<!-- indent and strip space for pretty output -->
<xsl:output indent="yes"/>
<xsl:strip-space elements="*"/>
<theme href="index.html" />
<after css:theme-children="body">
<xsl:call-template name="hello"></xsl:call-template>
</after>
<xsl:template name="hello">
<xsl:element name="div">
Hello!
</xsl:element>
</xsl:template>
</rules>
I found that diazo could be manage this in a file defined as xsl:stylesheet (https://github.com/plone/diazo/blob/master/lib/diazo/normalize-rules.xsl) rather directly in the rules, but how manage this in my add-on package?
Thank's
If you still have this issue, try the most recent versions of Diazo and plone.app.theming.
I cannot reproduce this issue with the latest versions (on Plone 4.3.3). For me, your rules example works just fine (as long as they are in the main [not rules file).
I'm trying to create some valid RSS 2.0 data and I can't get the "atom:link" to validate.
Is it because I havent done the page yet, or is it because I have some invalid format?
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
<channel>
<atom:link href="http://www.lasseedsvik.se/rss" rel="self" type="application/rss+xml" />
<title>Test Test</title>
<link>http://www.lasseedsvik.se/rss</link>
<description>test</description>
<language>sv-se</language>
<item>
<title>test</title>
<link>
http://www.lasseedsvik.se/123
</link>
<guid>
http://www.lasseedsvik.se/123
</guid>
<description>
<![CDATA[test]]>
</description>
</item>
</channel>
</rss>
A link to the validator error page would be useful to help you debug this.
But I think you may need to put the version before the nanemspace declaration, like so:
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
The validator may also want to see an XML prolog. Maybe you have one and just did not include it in your example.
Note that no validator is perfect. The one at feedvalidator.org, for example, carps about perfectly valid feeds that don't implement "best practices" defined by the validator's creators. So, the most important thing is to make sure your feed is valid XML, then make sure it complies with the RSS 2.0 spec.