473,791 Members | 3,251 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

xslt: create link from name

hi,

I have glossary-entries (<entry name="...">...</entry>) whose names
include 8bit-characters and spaces and each entry must be reachable by
(relative) html-links.

I want to avoid having to specify both a name and an id for linking
for each glossary term (if possible), so I'd like to generate links
(urls) from the names with some kind of algorithm.

I need (at least) a function that creates a valid url from a name
(i.e. "x y" => "x%20y").

thanks,

--
Felix Natter
Jul 20 '05 #1
6 2764
I think you may be looking for <xsl:element> and/or <xsl:attribut e> . look
at them.

Mike

"Felix Natter" <fn*****@gmx.ne t> wrote in message
news:m3******** ****@werkstatt4 .ldc...
hi,

I have glossary-entries (<entry name="...">...</entry>) whose names
include 8bit-characters and spaces and each entry must be reachable by
(relative) html-links.

I want to avoid having to specify both a name and an id for linking
for each glossary term (if possible), so I'd like to generate links
(urls) from the names with some kind of algorithm.

I need (at least) a function that creates a valid url from a name
(i.e. "x y" => "x%20y").

thanks,

--
Felix Natter

Jul 20 '05 #2
"Michael Hill" <hi****@charter .net> writes:
I think you may be looking for <xsl:element> and/or <xsl:attribut e> . look
at them.
No, I'm looking for a function/algorithm/idea to convert i.e.
"this Topic" to "this%20top ic" or similar. Without this function
I'd have to do this:

<entry name="Formular zurücksetzen" id="formularzur uecksetzen">
</entry>
<entry name="Faktura" id="faktura">
</entry>
...
and have some redundancy (@id) which is what I try to avoid. A
function like "url(@name) " (which would "urlify" @name, " "=>%20 etc.)
would be sufficient (if there's no better solution).

thanks in advance,
"Felix Natter" <fn*****@gmx.ne t> wrote in message
news:m3******** ****@werkstatt4 .ldc...
hi,

I have glossary-entries (<entry name="...">...</entry>) whose names
include 8bit-characters and spaces and each entry must be reachable by
(relative) html-links.

I want to avoid having to specify both a name and an id for linking
for each glossary term (if possible), so I'd like to generate links
(urls) from the names with some kind of algorithm.

I need (at least) a function that creates a valid url from a name
(i.e. "x y" => "x%20y").

thanks,

--
Felix Natter



--
Felix Natter
Jul 20 '05 #3
FC
I suppose that's the purpose of generate-id() function.
Have a look at it and see if it suits your needs.

Bye,
Flavio
Jul 20 '05 #4
"FC" <fl****@tin.i t> writes:
I suppose that's the purpose of generate-id() function.
Have a look at it and see if it suits your needs.


It won't work because it is not required that the ids
stay the same across stylesheet invocations (and for a glossary
the name-anchors need to stay the same)

From XSLT by Doug Tidwell:
"[...] All of tomorrow's calls to generate-id() will generate the same ID
but that ID might not be the one generated today."

--
Felix Natter
Jul 20 '05 #5
Felix Natter <fn*****@gmx.ne t> writes:
"Michael Hill" <hi****@charter .net> writes:
I think you may be looking for <xsl:element> and/or <xsl:attribut e> . look
at them.


No, I'm looking for a function/algorithm/idea to convert i.e.
"this Topic" to "this%20top ic" or similar. Without this function
I'd have to do this:

<entry name="Formular zurücksetzen" id="formularzur uecksetzen">
</entry>
<entry name="Faktura" id="faktura">
</entry>
...
and have some redundancy (@id) which is what I try to avoid. A
function like "url(@name) " (which would "urlify" @name, " "=>%20 etc.)
would be sufficient (if there's no better solution).


I found an extension which does this: encode-uri
(http://www.exslt.org/str/)

--
Felix Natter
Jul 20 '05 #6
Felix Natter <fn*****@gmx.ne t> writes:
Felix Natter <fn*****@gmx.ne t> writes:
"Michael Hill" <hi****@charter .net> writes:
I think you may be looking for <xsl:element> and/or
<xsl:attribut e> . look at them.


No, I'm looking for a function/algorithm/idea to convert i.e.
"this Topic" to "this%20top ic" or similar. Without this function
I'd have to do this:

<entry name="Formular zurücksetzen" id="formularzur uecksetzen">
</entry> <entry name="Faktura" id="faktura"> </entry> ...
and have some redundancy (@id) which is what I try to avoid. A
function like "url(@name) " (which would "urlify" @name, " "=>%20
etc.) would be sufficient (if there's no better solution).


I found an extension which does this: encode-uri
(http://www.exslt.org/str/)


Is there a better solution? It's a bit tedious to use
i.e. #Formular%20zur %C3%BCcksetzen as a link.

thanks,

--
Felix Natter
Jul 20 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2712
by: Sergio del Amo | last post by:
Hi, I use the xslt functions provided by php. I am running in my computer the package xampp(www.apachefriends.org) which includes php/apache/mysql .. In this package the php includes the sablotron extension responsible for the xslt functions. The problem i have is that the obtained transformation is not the waited one. I try to proccess the same XML file with XSL file with a program called XMLspy and i obtained the desire and waited...
6
2749
by: Pete | last post by:
I am just getting to grips with XML and I was wondering if you could help me with something that no-one seems able or willing to help with.. I have an XSLT file which should be transforming a straight XML file http://www.discovertravelandtours.com/test/templates/test.xml?Location=Germany To another XML file http://www.discovertravelandtours.com/test/templates/test2.xml?Location=Germany
2
3906
by: ted | last post by:
Was wondering if XSLT alone is appropriate for the following situation. From XML, I'm creating a small website (around 50 pages) with pages that link to each other through a nav menu and a "crumb-trail" of links. I'm transforming the XML with XSLT through Saxon. The nav menu and "crumb-trail" show the user where they are within the site and is made by reflecting the XML tree structure. My problem now is that when I want to generate...
6
2933
by: Ramon M. Felciano | last post by:
Helo all -- I'm trying to gain a deeper understand for what type of semi-declarative programming can be done through XML and XPath/XSLT. I'm looking at graph processing problems as a testbed for this, and came across a problem that I haven't been able to solve elegantly. The problem is to find "linker" vertexes that a pair of verteces from a pre-defined set. For example, if the graph verteces represent cities and edges represent flights...
0
2359
by: Christopher M. Lauer | last post by:
I have done my best to answer this question but can not find the proper set of commands. I would like to transform an xml file (in code behind) and display its output in a specific html tag, such as a div with a runat=server. I can somewhat do this if I create a server control and include the control within the html div tag but this method (borrowed from ASP.NET Website Programming by Wrox press thanks guys) does not give me the full...
7
2871
by: Harolds | last post by:
The code below worked in VS 2003 & dotnet framework 1.1 but now in VS 2005 the pmID is evaluated to "" instead of what the value is set to: .... xmlItems.Document = pmXML // Add the pmID parameter to the XSLT stylesheet XsltArgumentList xsltArgList = new XsltArgumentList(); xsltArgList.AddParam("pmID", "", pmID); xmlItems.TransformArgumentList = xsltArgList;
4
1680
by: dar_imiro | last post by:
Hi, I'm trying to get rid of frames as menu holder in my html-page. I'd also like to separate the menu structure to xml and xslt. Also the actual content is divided to xml and its corresponding stylesheet. The idea ofcourse is to import the separate menu.xml to the content.xslt file so the menu markup wont clutter every content.xml page.
1
1646
by: jrwarwick | last post by:
Hello, I believe I have uncovered a bug in the .Net XSLT engine to do with 'for' loops in XSLT. Here are the steps to reproduce it: -Create A new webform project. -Add the xml file 'errorexample.xml' - it is shown at the bottom -Add the xslt file 'errorexample.xslt' - it is shown at the bottom -Add a label into the WebForm1.aspx designer and stretch it so it is large, give it the ID of Output1. -Import the following namespaces in...
2
22780
jkmyoung
by: jkmyoung | last post by:
Here's a short list of useful xslt general tricks that aren't taught at w3schools. Attribute Value Template Official W3C explanation and example This is when you want to put dynamic values in the attribute of an element. Instead of using the <xsl:attribute> element, you can simply place the xpath in the attribute itself. The most common usage of this is in creating hyperlinks.
3
3702
by: saritha2008 | last post by:
Hi, As part of migrating bugs from JIRA to BugZilla, below is the requirement: If there are multiple “version” tags in my input.xml file For open bugs (Resolved,Reopened,Inprogress,NeedInfo) > create multiple bugs, one for each “version". “Fix version” will be empty. For closed bugs > create multiple bugs, one for each “Fixed in” version. Use earliest “version" for all bugs. I tried using the apply-template in the XSLT for the above...
0
9669
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9517
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10207
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10156
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5435
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5559
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4110
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3718
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2916
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.