I am writing XSLT to be used with XML in Aspose.PDF to generate the PDF, how do I insert the page break in the Aspose.PDF XSLT?
I have tried #$NP but it doesn't seem to be working, or my syntax is not correct.
<TextFragment>
<TextSegment>#$NP</TextSegment>
</TextFragment>
I have also tried to split the document by having a multiple page tags.
<Page>...</Page>
But that also didn't seem to work, and Aspose was actually throwing an error when I tried that, so what would be the correct way?
I would like to be able to insert the page break after each section of the PDF. Also any links to some advanced Aspose.PDF XSLT examples will be appreciated.
For the old Aspose.PDF versions, please, try this way:
<Text>
<Segment>
<!--Page Breaker-->
#$NP
</Segment>
</Text>
For the latest Aspose.PDF versions, please, try this way:
<Page>
<TextFragment>
<TextSegment>
First page.
</TextSegment>
</TextFragment>
</Page>
<Page>
<TextFragment>
<TextSegment>
Second page.
</TextSegment>
</TextFragment>
</Page>
Hope it helps. Otherwise, feel free to ask me.
Note: I am working as Developer Evangelist at Aspose.
Related
I use xsl fo as oracle apex report layout. After generate .pdf document some character is not correctly. Here is a lot of question and answer about that but nothing helped me.
In my solution I have this character:
<fo:block font-family="Tahoma">ČĆŽŠĐ čćžšđ</fo:block>
In pdf document get ##ŽŠ# ##žš#
I'm try different solution (change font, use encoding-mode="single-byte"...)
Is it possible put font path from online website?
Any solution?
I'm new at XSLT. I want to create a hyperlink using XSLT. Should look like this:
Document
Document is the link and upon clicking this, download of a file should begin.
Any ideas? :)
Thanks
There's no such thing as a hyperlink in XSLT or XML. If you're generating HTML with your XSLT, then you just need to output the appropriate elements and attributes, which you can do literally if you want, e.g.
<xsl:template match="somethingthatgeneratesalink">
This is a link to example.com
</xsl:template>
I am really facing a strange problem. ROMAN characters are not displaying at all in mozilla and google chrome except on IE8(not in IE10 as well).
The code was written using xsl transformations. and i am unable to find what does
<var name="ROMAN"> is? This is the exact text when i see the html source.
Even the same code is written in xsl.
Any help would be greatly appreciable.
<var> is an HTML element that means "This is a variable". It will typically cause the contained text to be rendered in italic. It doesn't mean anything special to XSLT, it's just like any other HTML element name. name="ROMAN" is just like the name attribute of any other HTML element, it can be used in Javascript to address the relevant element node in the page. It doesn't change the rendition of the element, unless perhaps there is some stylesheet somewhere that recognizes name="ROMAN" and associates it with a display style.
I think you've got an HTML question, not an XSLT question. There's something wrong with your HTML, and we don't know what, because you haven't given enough information.
I've been having a lot of trouble figuring this out.
What I want is a FAQ page that displays all the questions and answers on the same page. It gets the content from the questions and answers from subnode content.
So for example my tree looks like this:
FAQ
Question1
Question2
Question3
I want the template on FAQList to list the question and answer data from Question1...2... and 3 on the same page.
Every time I try to find examples of this being done I can only find examples that list the subpages as links. I don't want to link to the subpages. I want to actually print the content from them onto the parent page. Is that possible?
This is my attempt at it:
<xsl:for-each select="$currentPage/node">
Question: <xsl:value-of select="data [#alias = 'question']"/><br/>
Answer: <xsl:value-of select="data [#alias = 'answer']"/><br/>
</xsl:for-each>
But I had no results. Help me out here. I'm banging my head on this.
It all depends on the version of Umbraco you're running. There's a lot of documentation out there that refers to a much earlier version of Umbraco and simply won't work on more recent versions.
Assuming the document type alias of your questions is called 'FaqItem' and assuming that this XSLT is run on the respective content node (i.e. $currentPage is your FAQ parent node), you can use the following:
If you're using < Umbraco 4.5.1
<xsl:for-each select="$currentPage/child::node[#nodeTypeAlias='FaqItem']">
Question: <xsl:value-of select="./data[#alias='question']"/><br/>
Answer: <xsl:value-of select="./data[#alias='answer']"/><br/>
</xsl:for-each>
If you're using >= Umbraco 4.5.1
<xsl:for-each select="$currentPage/FaqItem">
Question: <xsl:value-of select="./question"/><br/>
Answer: <xsl:value-of select="./answer"/><br/>
</xsl:for-each>
For future reference
If you're familiar with XPath and want to figure out how Umbraco has stored the data, or to help with debugging. Look for a file called Umbraco.config (typically found in ~/App_Data/). This is the cached XML that all XSLTs will read from. Posting the relevant snippet from this file into your [Stack Overflow] question will increase the speed and chances of getting a response, as XSLT contributors will be able to help and not just Umbraco contributors.
Have to looked at razor? IMHO it is much easier to read and write.
#using System.Linq
#using System.Xml.Linq
#using umbraco.MacroEngines
#{
IEnumerable<DynamicNode> FAQs = new DynamicNode(Model.Id).Descendants("FaqItem").Items;
List<DynamicNode> faqList = FAQs.ToList();
#foreach(DynamicNode faq in faqList){
Question: #(faq.GetProperty("question").ToString())
Answer: #(faq.GetProperty("answer").ToString())
}
}
When I put forexample this in my xslt-stylesheet:
<link><xsl:text>test</xsl:text></link>
Or this:
<link>test</link>
I get the following result:
<link xmlns=""></link>
This however:
<linkb>test</linkb>
Render the following result:
<linkb xmlns="">test</linkb>
The rest of the xslt does not seem to make any difference, i've tried it in several different and empty xslt-stylesheets
This problem appears in backend conversion (php) aswell as frontend-konversion in chrome browser (but not in Firefox)
Example of error:
dev.resihop.nu
(right above the footer)
It's not really an XSLT issue.
<link xmlns="">
Is rendered by Chrome, problem is with built-in browser CSS:
link {
display: none;
}
You can see this with Chrome developer toolbar (just press Ctrl-Shift-I). I think it's also a reason of no rendering of tag's content. I guess Chrome just don't like elements with such names and treats them specifically.
Edit. And actually I do understand, why. Because of the link tag, which we all use in head section.
In fact the simpliest way to avoid issues like yours -- is to pick any suitable (X)HTML doctype and make your code valid, according to that doctype.
You probably did not declare an output method, which defaulted to HTML.
Try:
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
Best regards!