How to get rid of result-document href in generated a href?
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 9
- Joined: Tue Dec 13, 2005 7:42 pm
- Location: France
How to get rid of result-document href in generated a href?
Hello dears,
I'm quite new to Xslt and I'm trying to generate a complete html web site.Datas are enclosed in the XML file and I started by generating each /directory/page.htm one by one. Expecting something a little bit more "industrial" I googled and found two solutions : extensions with xslt 1.0 and the xslt2.0 result-document element. I was not able to set-up xslt1.0 with an appropriate extension in oxygen6.2 so I switched to xslt2.0 and the <xslt:result-document/> element, and Saxon8B.
The xslt file look like this :
And whatever I tried, for all <a/> generated elements, I can't control the <a href=""> attribute and get a {$vrepertoire} prefixe in every <a/> generated element.
I guess this is a known issue, but could not find information on the subject.
http://www.w3.org/TR/xslt20/#terminology
Thank you for reading !
I'm quite new to Xslt and I'm trying to generate a complete html web site.Datas are enclosed in the XML file and I started by generating each /directory/page.htm one by one. Expecting something a little bit more "industrial" I googled and found two solutions : extensions with xslt 1.0 and the xslt2.0 result-document element. I was not able to set-up xslt1.0 with an appropriate extension in oxygen6.2 so I switched to xslt2.0 and the <xslt:result-document/> element, and Saxon8B.
The xslt file look like this :
Code: Select all
xsl:template match="/">
<xsl:for-each select=" //page | //page-rubr | //page-sous-rubr">
<xsl:variable name="vrepertoire" select="ancestor::chapitre/repertoire-chap"></xsl:variable>
<xsl:variable name="extension" select=" '.htm' "></xsl:variable>
<xsl:result-document href="{$vrepertoire}/{.}{$extension}" />
<!-- ....code code ... code content generating OK-->
<!-- sidebar generating for the current page .... -->
<xsl:for-each select="rubrique">
<li>
<a>
<xsl:attribute name="href">
<xsl:value-of select="page-rubr"/><xsl:text>.htm</xsl:text>
</xsl:attribute>
<xsl:value-of select="titre-rubr"/>
</a>
</li>
</xsl:for-each>

I guess this is a known issue, but could not find information on the subject.
http://www.w3.org/TR/xslt20/#terminology
Do you dears have any clue ?It will often be the case that one final result tree contains links to another final result tree produced during the same transformation, in the form of a relative URI. The mechanism of associating a URI with a final result tree has been chosen to allow the integrity of such links to be preserved when the trees are serialized.
Thank you for reading !
loving being a human being
-
- Site Admin
- Posts: 2095
- Joined: Thu Jan 09, 2003 2:58 pm
Hi,
It is hard to say what is wrong as looking at the sample code you posted I cannot see any noticeable problem. You should check the content of the $vrepertoire variable after you compute it, for that you can either use the oXygen XSLT debugger or print the value with an xsl:message instruction.
For XSLT 1.0 there is a sample of writing to multiple files in oXygen/frameworks/xs3p where we extended the XS3P schema documentation stylesheet to generate chunks, for that we used the a stylesheet module from DocBook that provides a template that writes the file to disk and handles more XSLT 1.0 processors extensions (Xalan, Saxon, etc.).
Best Regards,
George
It is hard to say what is wrong as looking at the sample code you posted I cannot see any noticeable problem. You should check the content of the $vrepertoire variable after you compute it, for that you can either use the oXygen XSLT debugger or print the value with an xsl:message instruction.
For XSLT 1.0 there is a sample of writing to multiple files in oXygen/frameworks/xs3p where we extended the XS3P schema documentation stylesheet to generate chunks, for that we used the a stylesheet module from DocBook that provides a template that writes the file to disk and handles more XSLT 1.0 processors extensions (Xalan, Saxon, etc.).
Best Regards,
George
-
- Posts: 9
- Joined: Tue Dec 13, 2005 7:42 pm
- Location: France
Resolved
hello George,
Tried the debugger, it's a great tool.
The reason of the problem I met, I think, is that the generated links were relative to the uri of the generated page, wich was already in a directory, so when the generated links should have been :
<a href="generatedLinkDirectory/file.htm />,
And what was outputed was actually ;
<a href="GeneratedePageURI/generatedLinkDirectory/file.htm/>
Adding an empty variable solved this problem :
<a class="niv0" href="{concat($cfdu,'/',$pageCourante)}">
Thank you for your help
Tried the debugger, it's a great tool.
The reason of the problem I met, I think, is that the generated links were relative to the uri of the generated page, wich was already in a directory, so when the generated links should have been :
<a href="generatedLinkDirectory/file.htm />,
And what was outputed was actually ;
<a href="GeneratedePageURI/generatedLinkDirectory/file.htm/>
Adding an empty variable solved this problem :
<a class="niv0" href="{concat($cfdu,'/',$pageCourante)}">
Thank you for your help

loving being a human being
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