Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 31st, 2006, 07:26 PM
Friend of Wrox
 
Join Date: Jul 2006
Posts: 430
Thanks: 28
Thanked 5 Times in 5 Posts
Send a message via Yahoo to bonekrusher
Default Use but Hide Attribute

Hi all,

How do I hide this line
 <xsl:value-of select="@id" />

but use its value in the html output?



Code:
<xsl:template match="JBU:indexterm">
- <a>
- <xsl:attribute name="name">
  <xsl:value-of select="@name" /> 
  </xsl:attribute>
  <xsl:value-of select="@id" /> 
  </a>
  </xsl:template>


Thanks

 
Old July 31st, 2006, 11:58 PM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 449
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to r_ganesh76
Default

what do you mean by hiding?

Regards
Ganesh
http://ganeshprof.blogspot.com
 
Old August 1st, 2006, 03:29 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

I don't know what you mean. What HTML output are you trying to generate?

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old August 1st, 2006, 05:40 AM
Friend of Wrox
 
Join Date: Jul 2006
Posts: 430
Thanks: 28
Thanked 5 Times in 5 Posts
Send a message via Yahoo to bonekrusher
Default

Hi All,

The xslt codes spitz out this in HTML:

Code:
</a><p><a name="blue">Blueprint</a>
the browser view looks like this:

Code:
BlueprintFrom the very beginning, our goal
I want to hide the word "Blueprint" which is derived from

Code:
  <xsl:value-of select="@id" />
I only want to use "blue"(@name) as an anchor and "Blueprint" (@id) as a Index reference later on, but not see it in the HTML output.

I hope this helps.

Thx
Bones
 
Old August 1st, 2006, 06:20 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

You've already got code to output the name attribute:

<xsl:attribute name="name">
  <xsl:value-of select="@name" />
  </xsl:attribute>

Just do the same with the id attribute:
<xsl:attribute name="name">
  <xsl:value-of select="@id" />
</xsl:attribute>

or for brevity just do

<xsl:copy-of select="@name|@id"/>

I'm having trouble seeing where your difficulty lies.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old August 1st, 2006, 08:15 AM
Friend of Wrox
 
Join Date: Jul 2006
Posts: 430
Thanks: 28
Thanked 5 Times in 5 Posts
Send a message via Yahoo to bonekrusher
Default

Thanks, I try your suggestions.

The Difficulty lies in the @id in the output, but I need it for creating the index.

Ideally this:

"BlueprintFrom the very beginning, our goal"

Should be:

"From the very beginning, our goal"

"Blueprint" is the bookmark, but I dont want to see it in the output.
 
Old August 1st, 2006, 08:50 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Do you actually know what HTML "source" you want to generate? If so, show us. If not, then don't start trying to write XSLT code - you should never write a program if you don't what output you want to produce.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old August 1st, 2006, 09:59 AM
Friend of Wrox
 
Join Date: Jul 2006
Posts: 430
Thanks: 28
Thanked 5 Times in 5 Posts
Send a message via Yahoo to bonekrusher
Default

I dont think I am explaining correctly.

I know its in laymen’s, so please forgive me. I am trying to learn XSLT.

this is how it outputs now

Code:
</a><p><a name="blue">Blueprint</a>From the very beginning, our goal has blah blah etc..<p>
but I want to hide in the output the >Blueprint< because it is a bookmark not part of the text...



 
Old August 1st, 2006, 10:12 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

If all you want to do is to leave out the text that says "Blueprint", then just leave out the <xsl:value-of> instruction that writes this text.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old August 1st, 2006, 11:39 AM
Friend of Wrox
 
Join Date: Jul 2006
Posts: 430
Thanks: 28
Thanked 5 Times in 5 Posts
Send a message via Yahoo to bonekrusher
Default

Thanks for the help.

Bones







Similar Threads
Thread Thread Starter Forum Replies Last Post
Replace an attribute with another attribute georgemeng XSLT 8 June 10th, 2008 11:04 AM
Hide file phuc2583 Classic ASP Basics 1 January 14th, 2008 03:58 AM
Access to attribute values from class of attribute jacob C# 1 October 28th, 2005 01:11 PM
how can I hide my combobox? Shelly Javascript How-To 3 August 30th, 2003 09:59 PM
How to Hide Folder in C# manoj241176 VS.NET 2002/2003 0 July 29th, 2003 04:10 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.