how to insert a hyperlink in XSLT

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • maneshn
    New Member
    • Jan 2010
    • 2

    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:

    Code:
    <a href="http://server:9090/doc.pdf">copy of doc</a>
    instead I receive:

    Code:
    <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:

    Code:
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    	xmlns:xs="http://www.w3.org/2001/XMLschema" version="2.0">
    	<xsl:output method="xml" omit-xml-declaration="yes" />
    
    	<xsl:template match="gi:FormModel" xmlns:gi="http://www.myplace.com/gi/AJAXForms/List1.gi">
    		<xsl:element name="List-field2">
    			<xsl:for-each select="List-field1/List1-matrix">
    				<xsl:variable name="position" select="position()" />
    				<xsl:element name="ShortList2-matrix">
    					<xsl:element name="doc-map">
    						<link href="{//*[local-name()=concat('doc',$position,'-upload')]}">Copy of doc</link>
    					</xsl:element>
    				</xsl:element>
    			</xsl:for-each>
    		</xsl:element>
    	</xsl:template>
    
    </xsl:stylesheet>
    Last edited by Dormilich; Jan 28 '10, 03:06 PM. Reason: Please use [code] tags when posting code
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

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

    Comment

    • maneshn
      New Member
      • Jan 2010
      • 2

      #3
      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

      Comment

      • Dormilich
        Recognized Expert Expert
        • Aug 2008
        • 8694

        #4
        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 &#91;code] before and &#91;/code] after your code or use the # button (rightmost of the buttons) in the editor (advanced mode)

        Comment

        Working...