Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 12th, 2006, 06:01 PM
Friend of Wrox
 
Join Date: Jul 2006
Posts: 430
Thanks: 28
Thanked 5 Times in 5 Posts
Send a message via Yahoo to bonekrusher
Default XSLT to RTF

Hi All,

I am currently working on my XML to RTF conversion and have a question.

I am using the following code to create some bookmarks for each graphic. I am using "bkmkstart" and "bkmkend". Is there a line of code similiar to add revision marks with a begin and end tag?

Code:
<xsl:template match="JBU:graphic">
        <xsl:param name="maxwidth" select="7.30000"/>
        <xsl:param name="templatetablelevel" select="0"/>
        <xsl:for-each select="@href">
            <xsl:text>{\field{\*\fldinst{\ul0\chcbpat2 INCLUDEPICTURE "</xsl:text>
            <xsl:call-template name="write-text">
                <xsl:with-param name="text">
                    <xsl:if test="substring(string(.), 2, 1) = ':'">
                        <xsl:text>file:///</xsl:text>
                    </xsl:if>
                    <xsl:value-of select="translate(string(.), '#x5c;', '/')"/>
                </xsl:with-param>
            </xsl:call-template>
            <xsl:text>" \\* MERGEFORMAT \\d }}}</xsl:text>
        </xsl:for-each>
        <xsl:text>{\*\bkmkstart </xsl:text>
        <xsl:call-template name="write-text">
            <xsl:with-param name="text">
                <xsl:for-each select="@name">
                    <xsl:value-of select="."/>
                </xsl:for-each>
            </xsl:with-param>
        </xsl:call-template>
        <xsl:text>}</xsl:text>
        <xsl:text>{\*\bkmkend </xsl:text>
        <xsl:call-template name="write-text">
            <xsl:with-param name="text">
                <xsl:value-of select="translate(string('xxx'), ' ', '_')"/>
            </xsl:with-param>
        </xsl:call-template>
        <xsl:text>}</xsl:text>
    </xsl:template>


 
Old August 13th, 2006, 02:02 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

You need to phrase your question(s) more clearly. You can't assume that your reader knows what RTF looks like, or what the significance of bkmkstart and bkmkend are, or what "revision marks" are like. And there's no point copying some code to your posting unless you say why you are posting it. Does it work or doesn't it? Does it produce output that's not quite right? If so, what is the output and how do you want it to differ?

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old August 13th, 2006, 02:04 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

By the way, your code is full of constructs that are ridiculously inefficient, for example you wrote:

            <xsl:with-param name="text">
                <xsl:for-each select="@name">
                    <xsl:value-of select="."/>
                </xsl:for-each>
            </xsl:with-param>

where you could have written

<xsl:with-param name="text" select="@name"/>



Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old August 13th, 2006, 05:54 AM
Friend of Wrox
 
Join Date: Jul 2006
Posts: 430
Thanks: 28
Thanked 5 Times in 5 Posts
Send a message via Yahoo to bonekrusher
Default

Michael,

Thank you for your reply. I will try to be more clear. I've only been working with XSLT for only about a month now, so forgive my mistakes.

The code I posted above creates bookmarks in a Rich Text Format(RTF) file. For each <graphic> element, I have a @name attribute which creates the bookmark. The code works great ( as you mentioned, I will need to make it more efficient). I was able to create bookmarks. My question is; is that there a way to create revision marks (change marks or revision bars are used in printed publications normally on the left side of the page to indicate that that text was changed).
Thank you.
 
Old August 13th, 2006, 03:07 PM
Friend of Wrox
 
Join Date: Jul 2006
Posts: 430
Thanks: 28
Thanked 5 Times in 5 Posts
Send a message via Yahoo to bonekrusher
Default

Nevermind, I figured it out. "\revised" did the trick.

Bones








Similar Threads
Thread Thread Starter Forum Replies Last Post
Reading an RTF File apoorva_ca C# 2005 1 January 10th, 2008 11:34 AM
C# RTF To XML nagajeya ASP.NET 1.0 and 1.1 Professional 5 December 11th, 2007 12:14 PM
PDF and RTF from XML rajatake XML 2 March 28th, 2007 12:35 PM
Created RTF when try to open RTF, got an error not24 C# 0 March 31st, 2006 01:31 PM
hyperlinks of rtf files geetabajpai VB How-To 1 October 13th, 2005 04:44 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.