I want to create this:
<a href="domain.com?=USERNAME">Login</a>
where USERNAME = in XML so the HTML output is specific to the user currently logged in. Can anyone advise?
I know I can use:
<xsl:variable name="class" select="a:Subject"/>
<p class="{$class}">English</p>
To extract a value and use it as a CSS Class but what about using it for a link?
XSLT doesn't do hyperlinks. Rethink your question. When thinking about how to achieve something like this in XSLT, split the task into two: (a) decide what HTML you want to generate, and (b) decide what XSLT code you need in order to generate it.
XSLT (Extensible Stylesheet Language Transformations) is a language originally designed for transforming XML documents into other XML documents, or other formats such as HTML for web pages, plain text or XSL Formatting Objects, which may subsequently be converted to other formats, such as PDF, PostScript and PNG.
Incorporating <STYLE> Elements into an XSLT FileAn XSLT style sheet can emit HTML <STYLE> elements, including CSS specifications, directly into the HTML that results from the XSLT transformation. This option works best when the number of CSS rules is small and easily managed.
The <xsl:text> element is used to write literal text to the output. Tip: This element may contain literal text, entity references, and #PCDATA.
Think I might have answered it myself:
<xsl:variable name="username" select="Username"/>
<a href="{$username}">Login</a>
What's wrong with using xsl:attribute?
<a><xsl:attribute name='href' select='Username' />Login</a>
The same
<a href="domain.com?={$user}">OMG!</a>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With