473,378 Members | 1,094 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

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" />
  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>
  18. </xsl:stylesheet>
Jan 28 '10 #1

✓ answered by Dormilich

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

3 5195
8,658 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.

Jan 29 '10 #3
8,658 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

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

Similar topics

by: Randi | last post by:
Hi all, I there any way of putting an html hyperlink into a .xml file, and still be able to use the xml tags to format the page? Here is the code of the xml file(real simple) and the .css file. ...
by: Michael Hertz | last post by:
I am performing a XSLT stylesheet on a XML document and produce a new XML document. How can I insert in this new XML stylesheet a tag <currtime>..."the current date/time"....</currtime> where...
by: kk | last post by:
I have an xml file and write an xslt. Now I want to insert related elements from xslt to db directly for various data types. How can I do? Is there any existing tool for this? Thanks!
by: KL | last post by:
I am totally new to XML and confused as heck. I have my xml file and want one of my elements to be a website. Heck I even named the element website (I know real original), but I can't make the...
by: Mike | last post by:
I noticed from the msdn help that posting a large message to the event log is a bad practice. Logging a path to a file is better in this instance. Is it possible to send a hyperlink in an event log...
by: Peter Afonin | last post by:
Hello, I created an e-mail form pretty much as described in this article: http://www.4guysfromrolla.com/webtech/080801-1.shtml. It works great, but I cannot figure out one thing: I need to...
by: Newbie | last post by:
Hello I need some help to make a hyperlink in a XML file. My XML file: <?xml version="1.0" encoding="ISO-8859-1"?> <TERAPEUTLISTE> <TERAPEUT> <NAVN>Et navn</NAVN> <ADRESSEN>En...
by: jkflens | last post by:
Hello, i convert one XML-document by using XSLT into another XML-document. First change all attributes to elements is no problem. Then i try to insert a new element into the new document by...
by: mark4asp | last post by:
I want to write a xslt template to create a xhtml 1.0 (transitional) file which will be sent in as email. Here is a typical xml data file: <BatchEmail> <Domain>www.myDomain.com</Domain>...
by: adamace5o | last post by:
When i try to use post variables with php and mysql i can't get the insert into statement to accept varibles as values. If i use 'test' instead of $test it does work. I suspect it is something to do...
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.