469,271 Members | 1,713 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,271 developers. It's quick & easy.

how to insert a hyperlink in XSLT

I have the following piece of code used to map data from one AJAX form to another. However the output of the mapping has extra namespaces in it. how would I correct the XSL to have the correct output?

i expect to receive:

Expand|Select|Wrap|Line Numbers
  1. <a href="http://server:9090/doc.pdf">copy of doc</a>
instead I receive:

Expand|Select|Wrap|Line Numbers
  1. <a xmlns:xs="http://www.w3.org/2001/XMLschema" xmlns:gi="http://www.myplace.com/gi/AJAXForms/List1.gi" href="http://server:9090/doc.pdf">copy of doc</a>
this is the piece of code I use:

Expand|Select|Wrap|Line Numbers
  1. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  2.     xmlns:xs="http://www.w3.org/2001/XMLschema" version="2.0">
  3.     <xsl:output method="xml" omit-xml-declaration="yes" />
  4.  
  5.     <xsl:template match="gi:FormModel" xmlns:gi="http://www.myplace.com/gi/AJAXForms/List1.gi">
  6.         <xsl:element name="List-field2">
  7.             <xsl:for-each select="List-field1/List1-matrix">
  8.                 <xsl:variable name="position" select="position()" />
  9.                 <xsl:element name="ShortList2-matrix">
  10.                     <xsl:element name="doc-map">
  11.                         <link href="{//*[local-name()=concat('doc',$position,'-upload')]}">Copy of doc</link>
  12.                     </xsl:element>
  13.                 </xsl:element>
  14.             </xsl:for-each>
  15.         </xsl:element>
  16.     </xsl:template>
  17.  
  18. </xsl:stylesheet>
Jan 28 '10 #1

✓ answered by Dormilich

use the exclude-result-prefixes attribute in <xsl:stylesheet>

3 4820
Dormilich
8,651 Expert Mod 8TB
use the exclude-result-prefixes attribute in <xsl:stylesheet>
Jan 28 '10 #2
Thanks a million. It has brought me one step closer to my goal.

Now that I have the output as <a href='xxx.xx'</a> how would I code the XSL to change the output so that I get &lt;a href='xxx.xxx'&lt;/a&gt;

Also you ask me to use code tags when posting code - I have no idea how to do this. I am new to this and would appreciate your guidance.

Thanks
Manesh
Jan 29 '10 #3
Dormilich
8,651 Expert Mod 8TB
Now that I have the output as <a href='xxx.xx'</a> how would I code the XSL to change the output so that I get &lt;a href='xxx.xxx'&lt;/a&gt;
return it as <xsl:text>. you can’t do that with <xsl:element>.

Also you ask me to use code tags when posting code - I have no idea how to do this. I am new to this and would appreciate your guidance.
either type [code] before and [/code] after your code or use the # button (rightmost of the buttons) in the editor (advanced mode)
Jan 29 '10 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Randi | last post: by
3 posts views Thread by kk | last post: by
6 posts views Thread by KL | last post: by
reply views Thread by Mike | last post: by
9 posts views Thread by Peter Afonin | last post: by
1 post views Thread by Newbie | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.