PDA

View Full Version : Can XSLT recognize if something in a hyperlink?



spyderfx
April 13th, 2010, 11:23 PM
I'm trying to make it so when my XSLT displays my XML, for the URL column I want it to check to see if something starts with http:// (if its a link), and if it isn't to display whatever string is put in the XML.

Is this even possible?

icio
April 22nd, 2010, 02:57 PM
Edit: Disclaimer: I know nothing about this, btw.

Edit: I think you can use X-Path (or X-Query) in XSLT to utilize the function `fn:starts-with`, described on W3CSchools as:

Returns true if string1 starts with string2, otherwise it returns false
Example: starts-with('XML','X')
Result: true

Original Post (Use above method, ideally): These may provide you with what you're looking for. Regex allows you to query the format of the data.

http://www.xml.com/pub/a/2003/06/04/tr.html
http://www.dpawson.co.uk/xsl/rev2/regexExampler.html

Hope it helps :thumb: