473,411 Members | 2,289 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,411 software developers and data experts.

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 2741
I think you may be looking for <xsl:element> and/or <xsl:attribute> . look
at them.

Mike

"Felix Natter" <fn*****@gmx.net> 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:attribute> . look
at them.
No, I'm looking for a function/algorithm/idea to convert i.e.
"this Topic" to "this%20topic" or similar. Without this function
I'd have to do this:

<entry name="Formular zurücksetzen" id="formularzuruecksetzen">
</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.net> 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.it> 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.net> writes:
"Michael Hill" <hi****@charter.net> writes:
I think you may be looking for <xsl:element> and/or <xsl:attribute> . look
at them.


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

<entry name="Formular zurücksetzen" id="formularzuruecksetzen">
</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.net> writes:
Felix Natter <fn*****@gmx.net> writes:
"Michael Hill" <hi****@charter.net> writes:
I think you may be looking for <xsl:element> and/or
<xsl:attribute> . look at them.


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

<entry name="Formular zurücksetzen" id="formularzuruecksetzen">
</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
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...
6
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...
2
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...
6
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...
0
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,...
7
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...
4
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...
1
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...
2
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...
3
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) >...
0
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
0
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...
0
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,...
0
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...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.