Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Tricky XSLT question involving variables, serializing, processing instructions

From: Martin Honnen <mahotrash@-----.-->
To: NULL
Date: 4/2/2009 2:35:00 PM
Stryder wrote:

> What I want to do is to make a deep copy of children of <level> up to
> and not including <dont-touch-me> excluding <applied-name>, replace
> <link-to link-ref=""> with <link-to-bwd link-to-frag="@link-ref"> ,
> serialize it all and store it in a processing instruction.  

You will to abandon the copy-of approach and instead use the identity 
transformation template and add a template for transforming link-to 
elements into link-to-bwd elements.
I have also use a mode to separate that approach from other templates 
you might have:

     <xsl:template match="level">
         <xsl:variable name="make_me_a_pi">
             <xsl:apply-templates select="node()[not(self::applied-name) 
and not(self::dont-touch-me) and not(preceding-sibling::dont-touch-me)]" 
mode="m1"/>
         </xsl:variable>
         <xsl:element name="level">
             <xsl:copy-of select="@*"/>
             <xsl:processing-instruction name="a_pi" 
select="saxon:serialize($make_me_a_pi, 'serializer')"/>
         </xsl:element>
     </xsl:template>

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

     <xsl:template match="link-to" mode="m1">
       <link-to-bwd link-to-frag="{@link-ref}">
         <xsl:apply-templates select="@* | node()" mode="m1"/>
       </link-to-bwd>
     </xsl:template>


-- 

	Martin Honnen
	http://JavaScript.FAQTs.com/


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent