Friday, June 20, 2008

XSLT - javascript escaping

I could not find a way to do this without writing a template.
I started one then luckily through the power of the Internet found a better one.  Done by Jeni Tennison found in the xsl-list archives and I have reproduce here.

<xsl:template name="escape-javascript">
<xsl:param name="string" />
<xsl:choose>
<xsl:when test='contains($string, "&apos;")'>
<xsl:call-template name="escape-javascript">
<xsl:with-param name="string"
select
='substring-before($string, "&apos;")' />
</xsl:call-template>
<xsl:text>\'</xsl:text>
<xsl:call-template name="escape-javascript">
<xsl:with-param name="string"
select
='substring-after($string, "&apos;")' />
</xsl:call-template>
</xsl:when>
<xsl:when test="contains($string, '&#xA;')">
<xsl:call-template name="escape-javascript">
<xsl:with-param name="string"
select
="substring-before($string, '&#xA;')" />
</xsl:call-template>
<xsl:text>\n</xsl:text>
<xsl:call-template name="escape-javascript">
<xsl:with-param name="string"
select
="substring-after($string, '&#xA;')" />
</xsl:call-template>
</xsl:when>
<xsl:when test="contains($string, '\')">
<xsl:value-of select="substring-before($string, '\')" />
<xsl:text>\\</xsl:text>
<xsl:call-template name="escape-javascript">
<xsl:with-param name="string"
select
="substring-after($string, '\')" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise><xsl:value-of select="$string" /></xsl:otherwise>
</xsl:choose>
</xsl:template>

Thursday, June 19, 2008

Calling all girl geeks

Girly Geekdom blog is running a competition to get more girls presenting at DDD this year. All you have to do is submit a session for DDD and if your session is selected you could win a 1 year MSDN subscription. For full details:

http://girlygeekdom.blogspot.com/2008/06/submit-ddd-session-win-msdn-premium.html

Technorati Tags: ,,,

Wednesday, June 18, 2008

alt.net london beers

Had a good evening last night with the alt.net lads and lady. About 15 people turned up for either the beers and talk and/or dinner.This was only the second one and seeing if people will turn up. Mainly intros and telling others what you are doing technology wise. REST seemed to be the main topic for the main part "resources not services !".

alt.net_2_london_18

Here are some photos from the evening http://www.flickr.com/photos/holytshirt/sets/72157605676029098/

Seb is still coming up with a format for the night. Which will follow something like this:

18:30 - 19:00 drinks
19:00 - 20:00 talk about a predetermined topic
20:00 - late    dinner and each person comments on the topic, which gets posted up.

How should we tag our posts, photos ?

1. alt.net, london, beers
2. alt.net.uk.london.beers

Should we compile a list of attendees ?

See you next time !

Technorati Tags:

String array to Int array

Note to self, putting it down in writing so I don't forget it for the umpteenth time.

string stringOfNumbers = "1,2,3,4,5,6,7";
string[] stringNumbers = stringOfNumbers.Split(',');
int[] numbers = Array.ConvertAll(stringNumbers, s => int.Parse(s));