RE: [xsl] URL rewriting with session id

Subject: RE: [xsl] URL rewriting with session id
From: "Shane Porter" <Shane.Porter@xxxxxxxxxxxxxxx>
Date: Wed, 27 Aug 2003 15:14:41 +0100
Thank you very much for your time and effort Michael - that works well.


-----Original Message-----
From: Michael Kay [mailto:mhk@xxxxxxxxx]
Sent: 27 August 2003 14:26
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE: [xsl] URL rewriting with session id


You'll find an example of the identity template under xsl:copy on p194.

Basically you want something like this:

<xsl:apply-templates select="document(
   '../xml_inc/documentname.xml')/include/*" mode="copy"/>

<xsl:template match="*" mode="copy">
  <xsl:copy>
  <xsl:copy-of select="@*"/>
  <xsl:apply-templates mode="copy"/>
  </xsl:copy>
</xsl:template>

<xsl:template match="a" mode="copy">
  <xsl:copy>
  <xsl:copy-of select="@*"/>
  <xsl:attribute name="href">
    <xsl:value-of select="concat(@href, $sessionId)"/>
  </xsl:attribute>
  <xsl:apply-templates mode="copy"/>
  </xsl:copy>
</xsl:template>

This is assuming that $sessionId is a global parameter to the
stylesheet.

Michael Kay

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> Shane Porter
> Sent: 27 August 2003 12:50
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE: [xsl] URL rewriting with session id
> 
> 
> >> <xsl:copy-of select="document(
> >> '../xml_inc/documentname.xml')/include/*"/>
> >> 
> >> The problem is that these documents have hyperlinks embedded
> >> in them, but these of course do not have the session ID.  How 
> >> to do extend the xsl statement above to put in the session ID?
> >> 
> 
> >xsl:copy-of can only make an unmodified copy. If you need a modified
> >copy, then you need to recurse through the tree using
> >xsl:apply-templates. Use the identity template rule for most 
> nodes, and
> >override it for the elements that define the hyperlinks.
> 
> >Michael Kay
> 
> I have to admit to being quite a newbie at all this - is it 
> possible to give me some more help, or point me in the right 
> direction.  I have your XSLT Programmer's Reference 2nd 
> edition - so if it's in there, great.
> 
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread