xsl-list
[Top] [All Lists]

RE: [xsl] Replace content of element, then transform it...

2012-08-30 08:02:10
Right. I take that note.

I am also noticing that disable-output-escaping is deprecated in XSLT2.0, so I 
guess I shall try and figure out another way of doing this...

Trond


-----Original Message-----
From: Michael Kay [mailto:mike(_at_)saxonica(_dot_)com] 
Sent: 30. august 2012 14:37
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] Replace content of element, then transform it...

One of the main reasons that we've been telling people for 12 years not to use 
disable-output-escaping is that it couples the transformation too closely to 
the serialization, meaning it's difficult and inefficient to reuse your code as 
part of a pipeline. A lot depends on what this d-o-e stuff is really doing. 
Having said that, from the information supplied I don't know why you are 
getting the error you are.

Michael Kay
Saxonica


On 30/08/2012 12:08, trond(_dot_)huso(_at_)ntb(_dot_)no wrote:
Hi,

I have the following XSLT.
<xsl:template match="body">
         <body>
             <xsl:value-of select="." disable-output-escaping="yes"/>
         </body>
     </xsl:template>

     <xsl:template match="leadtext">
         <leadtext>
             <xsl:value-of select="." disable-output-escaping="yes"/>
         </leadtext>
     </xsl:template>


     <xsl:template match="node()|@*">
         <xsl:copy>
             <xsl:apply-templates select="node()|@*"/>
         </xsl:copy>
     </xsl:template>

Which does what is intended. Just that I want to not output it, but start w= 
orking on it in a phase-two process.
So I tried this

<xsl:template match="body">
         <body>
             <xsl:value-of select="." disable-output-escaping="yes"/>
         </body>
     </xsl:template>

     <xsl:template match="leadtext">
         <leadtext>
             <xsl:value-of select="." disable-output-escaping="yes"/>
         </leadtext>
     </xsl:template>


     <xsl:template match="node()|@*">
         <xsl:variable name="foo">
         <xsl:copy>
             <xsl:apply-templates select="node()|@*"/>
         </xsl:copy>
         </xsl:variable>
         <xsl:apply-templates select="$foo" mode="phase2" />
     </xsl:template>
<!-- Error message:
Description: Cannot create an attribute node (id) whose parent is a 
documen= t node
-->

After reading about how this works, I now understand why I am getting the e= 
rror. Is there another alternative to make this possible in one document, o= 
r do I have to send the output to a new document?

Best regards,

Trond Husø
System Developer
Mobile : +47 450 35 715
E-mail : trond(_dot_)huso(_at_)ntb(_dot_)no
www.ntb.no




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--