Hello all,
Im using XSLT to grab data from an XHTML page, part of the data I wish to grab is a Postcode, this is the XSLT statement I have to grab the postcode:
<xsl:for-each select=".//h:a[starts-with(@href, 'http://local.google.com')]">
<xsl:variable name="postcode" select="@href"/>
<myns:hasPostcode><xsl:value-of select="$postcode" /></myns:hasPostcode>
</xsl:for-each>
The result of which I store in a variable $postcode. The variable will always be in this format:
http://local.google.com/maps?f=q&hl=en&q=BN1%203HH&ie=UTF8&z=17&om=1&iwloc=A
I wish to use a RegExp in the XSLT to grab the postcode (in bold). The postcodes are all in similar Google URL's format q=BN1%203HH& q=BN3%206QB&
Is it possible to grab the text after the "q=" (in example BN1) but after the % character only grab the first 3 characters, as the second part of a UK postcode can only be three characters.
I really appreciate any advice, I have tried some RegExp but just cant get them to work.
Thanks.