javajoemorgan Posted February 5, 2008 Share Posted February 5, 2008 I have a small piece of xml that contains a reference to an image, and the reference needs to be changed. I suspect the replace function is good for that. Here's the actual code snippet that tries to create the anchor to the image derived from the GRAPHICFILEPATH attribute of a nested GRAPHIC element: <a class="clsGraphicLink" href="{replace(GRAPHIC/@GRAPHICFILEPATH, 'aaaa.bbbb.com', 'xxxx.yyyy.com/extImage')}" target="_blank"> Fig. <xsl:number format="1" level="any"/>: <xsl:value-of select="CAPTION"/></a> The GRAPHICFILEPATH contains a direct link to the image, however, we can't have that in our resulting HTML page. We have to have it point back to us. So, if the actual GRAPHICFILEPATH = "http://aaaa.bbbb.com/images/BlueBonnet.jpg", it just needs to be output as "http://xxxx.yyyy.com/extImage/images/BlueBonnet.jpg". So, I "thought" the above replace function would work, but it is returning a blank.I am 1000% percent certain the value of GRAPHICFILEPATH contains the "aaaa.bbbb.com".... just why is the replace not working?I'm getting: <a class="clsGraphicLink" href="" target="_blank">Fig whatever</a> Link to comment Share on other sites More sharing options...
boen_robot Posted February 5, 2008 Share Posted February 5, 2008 Are you sure you have an XSLT 2.0 processor, and that you've declared 'version="2.0"' at the top of the stylesheet? The replace() function is only available in XSLT 2.0. Link to comment Share on other sites More sharing options...
javajoemorgan Posted February 5, 2008 Author Share Posted February 5, 2008 Are you sure you have an XSLT 2.0 processor, and that you've declared 'version="2.0"' at the top of the stylesheet? The replace() function is only available in XSLT 2.0.I do have 'version="2.0"' declared, and am fairly certain the processor is v2. Is there a poor man's way of finding out via the XSL. The device I'm using doesn't tell me directly. Link to comment Share on other sites More sharing options...
boen_robot Posted February 5, 2008 Share Posted February 5, 2008 I do have 'version="2.0"' declared, and am fairly certain the processor is v2. Is there a poor man's way of finding out via the XSL. The device I'm using doesn't tell me directly. <xsl:value-of select="system-property('xsl:version')"/> will tell you what version of XSLT can your XSLT processor process. If it's at least SAXON 8 or AltovaXML2007 (and you know THAT for sure), there's no even need to do the system property part - those processors are known to support XSLT 2.0. Link to comment Share on other sites More sharing options...
javajoemorgan Posted February 5, 2008 Author Share Posted February 5, 2008 <xsl:value-of select="system-property('xsl:version')"/> will tell you what version of XSLT can your XSLT processor process. If it's at least SAXON 8 or AltovaXML2007 (and you know THAT for sure), there's no even need to do the system property part - those processors are known to support XSLT 2.0. OK...cool and not so cool! It plainly returned version 1.What options do I have? Link to comment Share on other sites More sharing options...
javajoemorgan Posted February 5, 2008 Author Share Posted February 5, 2008 OK...cool and not so cool! It plainly returned version 1.What options do I have?Resolved! I was able to use an EXSLT replace function in its place.... works fine now. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.