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 November 7th, 2007, 11:00 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

Rather than outputting the "<ins>" in the revBegin it would be better to move the above code to a named template and then do the following:

<xsl:choose>
<xsl:when test="is insert">
  <ins>
    <xsl:call-template name="newtemplate"/>
  </ins>
</xsl:when>
<xsl:when test="is delete">
  <del>
    <xsl:call-template name="newtemplate"/>
  </del>
</xsl:when>
</xsl:choose>

So no <xsl:text> nodes, and no need for 'disable-output-escaping'.

/- Sam Judson : Wrox Technical Editor -/
 
Old November 8th, 2007, 06:03 AM
Authorized User
 
Join Date: Oct 2007
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,
  I couldnt understand "How can I put
 <ins>
    <xsl:call-template name="newtemplate"/>
  </ins>
instead of only &lt;ins&gt; since my revEnd also outputs &/lt;ins&gt;
If I do like you say what will come there in my revEnd and whats the functionality of "newtemplate". Could you please tell me.

 I have another problem here, after transforming xml, its outputting the whitespaces as &nbsp; to my emulator. How can I escape these whitespaces.

Thanks
Aruna.G



Quote:
quote:Originally posted by samjudson
 Rather than outputting the "&lt;ins&gt;" in the revBegin it would be better to move the above code to a named template and then do the following:

<xsl:choose>
<xsl:when test="is insert">
  <ins>
    <xsl:call-template name="newtemplate"/>
  </ins>
</xsl:when>
<xsl:when test="is delete">
  <del>
    <xsl:call-template name="newtemplate"/>
  </del>
</xsl:when>
</xsl:choose>

So no <xsl:text> nodes, and no need for 'disable-output-escaping'.

/- Sam Judson : Wrox Technical Editor -/
 
Old November 8th, 2007, 06:16 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

You really need to rewrite this code. You are trying to output lexical XML (angle bracket markup) by using disable-output-escaping, and that simply isn't the right way to use XSLT. XSLT is about creating trees first, and serializing them later. When you want to create an element, you should either use a literal result element in the stylesheet, or an xsl:element instruction. The instructions that create the attributes and children of an element in the result tree should be children of the instructions that create that element.

As a result your code structure is all wrong, and your problem with the error message you reported is a symptom of this. Sorry to be brutal, but I would chuck out what you have and start again, with the firm resolution never to use d-o-e.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old November 8th, 2007, 09:12 AM
Authorized User
 
Join Date: Oct 2007
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default


  Actually this xslt was from one of my colleague, after our discussion I asked him about it. They said that they did it intentionally only since we have a service which applies our xslt rules. I have to discuss with my supervisor and come to you again.

Quote:
quote:Originally posted by mhkay
 You really need to rewrite this code. You are trying to output lexical XML (angle bracket markup) by using disable-output-escaping, and that simply isn't the right way to use XSLT. XSLT is about creating trees first, and serializing them later. When you want to create an element, you should either use a literal result element in the stylesheet, or an xsl:element instruction. The instructions that create the attributes and children of an element in the result tree should be children of the instructions that create that element.

As a result your code structure is all wrong, and your problem with the error message you reported is a symptom of this. Sorry to be brutal, but I would chuck out what you have and start again, with the firm resolution never to use d-o-e.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
WML and XSL transformation. Feodorov XSLT 2 February 13th, 2008 05:00 PM
aspx for wml arunagottimukkala ASP.NET 1.0 and 1.1 Professional 0 October 26th, 2007 05:35 AM
aspx with wml arunagottimukkala ASP.NET 1.x and 2.0 Application Design 0 October 25th, 2007 09:39 AM
WML and WAP help knight Classic ASP XML 1 February 28th, 2005 07:59 AM
where is wml.jar mask95 All Other Wrox Books 1 August 19th, 2004 09:17 PM





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