import/include/etc.

Here should go questions about transforming XML with XSLT and FOP.
coupes
Posts: 12
Joined: Tue Jun 14, 2005 6:40 pm

import/include/etc.

Post by coupes » Thu Jun 16, 2005 5:07 pm

I was wondering if it was possible to somehow "include" a text file that's not a valid xml file. I'm trying to make a header and footer and import them, however, using xsl:import and xsl:include, your text file has to be a valid xml file. My problem is that some of the tags opened in the header are closed in the footer, making both files invalid xml files. I've tried using the new unparsed-text() function to import the files, but my files are then turned into a string and considered as text.

So, is possible to do what I'm trying to do ?

Thanks in advance.

Radu
Posts: 6335
Joined: Fri Jul 09, 2004 5:18 pm

Post by Radu » Fri Jun 17, 2005 5:26 pm

Hi,

Appending header and footer to an XSL Transformation result is easy in Oxygen. Just edit the scenario you are using for transformation, press the "Append header and footer" button and input the 2 files from which the header and footer parts will be read. and appended to the result

Importing/including not well formed content into your stylesheet is not an option.

Regards, Radu.

coupes
Posts: 12
Joined: Tue Jun 14, 2005 6:40 pm

Post by coupes » Mon Jun 20, 2005 6:29 pm

Thanks for your reply,

The problem I see with this solution is that the files have to be parsed using Oxygen. However I'm only using Oxygen to develop and I'm gonna use a serverside software to generate my html files. Anyways, I finally decided to include the html tags inside the .xsl files.

Thanks again,
Coupes

sorin_ristache
Posts: 4144
Joined: Fri Mar 28, 2003 2:12 pm

Post by sorin_ristache » Tue Jun 21, 2005 11:22 am

coupes wrote:The problem I see with this solution is that the files have to be parsed using Oxygen.
Hello,

No, the header and footer files that you set in the Header / Footer dialog are not parsed. They are just added at the beginning and the end of the XSLT transformation result. The Header / Footer dialog is opened by the Append header and footer button from the Edit scenario dialog.

Best regards,
Sorin

kwalsh
Posts: 4
Joined: Thu Feb 09, 2006 7:36 pm

Header and footer files appended to a docbook

Post by kwalsh » Fri Feb 10, 2006 6:37 pm

Hello,

I Appended a header and footer from the Edit scenario dialog for my big docbook file. It transforms, chucks, applies css all fine. BUT, the header and footer files are only applied to an opening page, and no other pages. How do I apply the header and footer to ALL chuncked pages? Using docbook.xsl.

Thanks,
k

sorin_ristache
Posts: 4144
Joined: Fri Mar 28, 2003 2:12 pm

Post by sorin_ristache » Mon Feb 13, 2006 7:18 pm

Hello,

The chunk files generated by the DocBook chunk.xsl stylesheet are a particular case of XSLT transformation. The chunk.xsl stylesheet generates more than one output file different from the output file supplied as parameter to the transformer so <oXygen/> cannot know the number or names of those output files in order to append a header/footer to them too. You have to add headers and footers in a specific way, that is in a DocBook customization layer which customizes the DocBook templates user.header.content / user.header.navigation and user.footer.content / user.footer.navigation.

Regards,
Sorin

kwalsh
Posts: 4
Joined: Thu Feb 09, 2006 7:36 pm

Appending footer

Post by kwalsh » Wed Feb 22, 2006 5:56 am

I tried to append a header / footer via the Oxygen gui w/ no luck. I'm using the Javahelp.xsl stylesheet. As it turns out, I only need a footer, so I tried adding an additional stylesheet, w/ a template for copyright info, and put my footer info in as copyright info. Got an error, so now I'm trying an include tag.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:param name="target.window" select="'contentsFrame'"/>
<xsl:template name="user.head.content">
<base target="{$target.window}"/>
</xsl:template>

<xsl:template name="user.footer.content">
<div>
<xsl:text disable-output-escaping="yes">
<%@ include file="common/footer.htm" %>
</xsl:text>
</div>
</xsl:template>

</xsl:stylesheet>


Now I get the following error: "E Premature end of file" and the transformation fails.

Can anyone tell me what to do about this error?

Thanks,
Kate

sorin_ristache
Posts: 4144
Joined: Fri Mar 28, 2003 2:12 pm

Post by sorin_ristache » Wed Feb 22, 2006 11:47 am

Hello,

Try to validate the XML input and the XSL input of the transformation. Do you get validation errors ?

Regards,
Sorin

kwalsh
Posts: 4
Joined: Thu Feb 09, 2006 7:36 pm

Post by kwalsh » Wed Feb 22, 2006 8:25 pm

On save, as it checks for errors, it then says, "Document has no errors" on both the xsl sheet, as well as the xml document.

I actually get "no errors" in my xsl sheet weather I have a template block of code that has all of the footer code (which is not much) or the template block has an include directive to incldue a footer.htm file. Or Both!

my "additional" xsl sheet:
_________________________________

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:param name="target.window" select="'contentsFrame'"/>
<xsl:template name="user.head.content">
<base target="{$target.window}"/>
</xsl:template>

<xsl:template name="user.footer.content">

<! THIS IS THE ACTUAL FOOTER CODE -->

<p>
<hr/>
The contents of this file are subject to the EchoStorm Inc. License Version 1.0 (the "License"). You may not use this file except in compliance with the License.
The Initial Developer of the Original Code is EchoStorm, Inc. Portions Copyright 2002-2005 EchoStorm, Inc. All Rights Reserved.
</p>

<script>
<!--

function invoke(url) {

top.invoke(url);

// force update update for URL's for anchor tags
if (url.indexOf("#") > -1) {
top.toolbarframe.hist.update();
}
}


top.toolbarframe.hist.update();
// -->
</script>

<! END OF ACTUAL FOOTER CODE -->


<!-- OR I CAN INCLUDE THE ABOVE FOOTER CODE FROM AN OUTSIDE FILE. Either way, Oxygen says the page has no errors. But the transformation fails, and it gives the error: E Premature end of file. -->


<xsl:text disable-output-escaping="yes">
<%&include file="common/footer.htm" &<
</xsl:text>
</xsl:template>
</xsl:stylesheet>

_______________________________


Any ideas how to get past the error??

Thanks,
Kate

sorin_ristache
Posts: 4144
Joined: Fri Mar 28, 2003 2:12 pm

Post by sorin_ristache » Thu Feb 23, 2006 5:42 pm

Hello,

Post the XML and XSL sources of the transformation. If they are large first reduce them to small sample files.

Regards,
Sorin

Post Reply