Regular expressions are useful here if you know them:
http://www.w3.org/TR/xpath-functions/#string.match

-----Original Message-----
From: Hoover, Jacob [mailto:jacob.hoo...@greenheck.com] 
Sent: 11 February 2013 19:31
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] [Wix-users] XSLT

Hmm,
  I am no XSLT GURU, but could you do...

<xsl:template name="replace-string">
    <xsl:param name="text"/>
    <xsl:param name="replace"/>
    <xsl:param name="with"/>
    <xsl:choose>
      <xsl:when test="contains($text,$replace)">
        <xsl:value-of select="substring-before($text,$replace)"/>
        <xsl:value-of select="$with"/>
        <xsl:call-template name="replace-string">
          <xsl:with-param name="text"
select="substring-after($text,$replace)"/>
          <xsl:with-param name="replace" select="$replace"/>
          <xsl:with-param name="with" select="$with"/>
        </xsl:call-template>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="$text"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

<xsl:template match="wix:RegistryValue/@Value">
        <xsl:attribute name="Value">
                <xsl:choose>
                        <xsl:when test="starts-with(.,
'C:\windows\system32')">
                                <xsl:call-template name="replace-string">
                                          <xsl:with-param name="text"
select="."/>
                                          <xsl:with-param name="replace"
select="'C:\windows\system32'" />
                                          <xsl:with-param name="with"
select="'[SystemFolder]'"/>
                                </xsl:call-template>
                        </xsl:when>
                        <xsl:otherwise>
                                <xsl:value-of select="."/>
                        </xsl:otherwise>
        </xsl:choose>
        </xsl:attribute>
</xsl:template>

-----Original Message-----
From: Gabriel Ivanes [mailto:g...@fastmail.net]
Sent: Monday, February 11, 2013 10:16 AM
To: wix-users@lists.sourceforge.net
Subject: Re: [WiX-users] [Wix-users] XSLT

I already has a template. I changed attributes components few times.
In this case, i don't know how to identify template :

  <xsl:template match="wix:RegistryValue">
    <RegistryValue Value="@Value">
      <xsl:apply-templates select="[SystemFolder]"/>
    </RegistryValue>
  </xsl:template>

This is bad.

Sure i want to resolv my issue, but i also wanted advises of good
documentation with a wix approach.
I find Nick's book to be a good way to learn wix. Maybe Wix's community has
well-know ressource for XSLT.
Thanks.

Le %:Date:, "Hoover, Jacob" <jacob.hoo...@greenheck.com> a écrit:
> I assume you mean how do I invoke an XSLT from heat.  The "wix specific"
> portion is simply passing -t transformfilename.xslt.  From there on 
> out, it's all just XSLT.
> 
> Here's an identity template to get you started:
> 
> <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0"
>   xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
>   xmlns:msxsl="urn:schemas-microsoft-com:xslt"
>   xmlns:wix="http://schemas.microsoft.com/wix/2006/wi";
>   exclude-result-prefixes="msxsl wix">
>   <xsl:output method="xml" indent="yes"/>
>   <xsl:namespace-alias result-prefix="#default" stylesheet-prefix="wix"
>   />
> 
>   <xsl:template match="@* | node()">
>     <xsl:copy>
>       <xsl:apply-templates select="@* | node()"/>
>     </xsl:copy>
>   </xsl:template>
> </xsl:stylesheet>
> 
> >From there, it's up to you to determine which element's you want to
change. If you wanted to tweak a directory, you'd use something like
<xsl:template match="wix:Directory">.
> 
> 
> Jacob
> 
> -----Original Message-----
> From: Gabriel Ivanes [mailto:g...@fastmail.net]
> Sent: Monday, February 11, 2013 9:50 AM
> To: wix-users@lists.sourceforge.net
> Subject: [WiX-users] [Wix-users] XSLT
> 
> Good day,
> 
> Any good tutorial to use xsl with wix ?
> 
> For example, replacing "C:\windows\system32" with [SystemFolder] in a 
> reg's file with heat.
> 
> Thanks.
> 
> --
> Sincerely,
> Gabriel
> 
> "I know no way of judging the future but by the past."
>     Patrick Henry
> "You can never plan the future by the past."
>     Edmund Burke
> 
> ----------------------------------------------------------------------
> --------
> Free Next-Gen Firewall Hardware Offer
> Buy your Sophos next-gen firewall before the end March 2013 and get 
> the hardware for free! Learn more.
> http://p.sf.net/sfu/sophos-d2d-feb
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
> 
> ----------------------------------------------------------------------
> --------
> Free Next-Gen Firewall Hardware Offer
> Buy your Sophos next-gen firewall before the end March 2013 and get 
> the hardware for free! Learn more.
> http://p.sf.net/sfu/sophos-d2d-feb
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users


--
Sincerely,
Gabriel

"I know no way of judging the future but by the past."
    Patrick Henry
"You can never plan the future by the past."
    Edmund Burke

-----------------------------------------------------------------------------
-
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 and get the
hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users
-----------------------------------------------------------------------------
-
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 and get the
hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users
SDL PLC confidential, all rights reserved.
If you are not the intended recipient of this mail SDL requests and requires 
that you delete it without acting upon or copying any of its contents, and we 
further request that you advise us.
SDL PLC is a public limited company registered in England and Wales.  
Registered number: 02675207.
Registered address: Globe House, Clivemont Road, Maidenhead, Berkshire SL6 7DY, 
UK.
------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to