p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   XSLT (http://p2p.wrox.com/forumdisplay.php?f=86)
-   -   create links using XSL (http://p2p.wrox.com/showthread.php?t=72783)

prashob_2 February 17th, 2009 01:18 PM

create links using XSL
 
I have following types XML Data:


<PAGE METAKEY="9781934043769" LABEL="146">
<INDENTPARA>There is no shortage of histor...</INDENTPARA>
...
</PAGE>

....
....
<INDEXITEM1><INDEXITEMCONTENT>industrial schools,</INDEXITEMCONTENT> <INDEXITEMPAGE METAKEY="9781934043769" LABEL="8">8</INDEXITEMPAGE> <INDEXITEMPAGE METAKEY="9781934043769" LABEL="128">128</INDEXITEMPAGE> <INDEXITEMPAGE METAKEY="9781934043769" LABEL="146">146</INDEXITEMPAGE></INDEXITEM1>


What i want to do is to create a link between these attribute values(attribute values are actually page numbers) using XSL.

style sheet namespace i am follow is the following:

<xsl:stylesheet xmlns:xsl="......TR/WD-xsl>


Thanks in advance..

mhkay February 17th, 2009 01:30 PM

The WD-xsl language has been obsolete for over ten years now, and information on it is very hard to find - I doubt you will get any help with it here.

But apart from that, I don't really understand your requirement. Please show the XML or HTML output that you want to produce.

Martin Honnen February 17th, 2009 01:32 PM

First of all the XSLT 1.0 and 2.0 namespace is http://www.w3.org/1999/XSL/Transform. If you use a different namespace then I am afraid you are not trying to use XSLT but rather an old predecessor of XSLT that is only implemented by MSXML 3 or earlier and nowadays not even used anymore.

As for your transformation question, what exactly do you want to achieve? Do you want to transform that XML to HTML and create HTML links? Or what kind of link exactly do you want to create?
Provide a sample of the output you want the XSLT stylesheet to create from the input you posted.

prashob_2 February 17th, 2009 10:24 PM

i had make try with namespace http://www.w3.org/1999/XSL/Transform also. We want to display the html output of xml file. In this html we have cross-refer the id's.

Martin Honnen guess the exact requirement.

mrame February 18th, 2009 12:11 AM

Try this:

Code:


<xsl:template match="PAGE">
<a>
<xsl:attribute name="name">
<xsl:value-of select="@LABEL"></xsl:value-of>
</xsl:attribute>
</a>
<p><xsl:value-of select="INDENTPARA"></xsl:value-of></p>
</xsl:template>

<xsl:template match="INDENTPARA"></xsl:template>

<xsl:template match="INDEXITEMPAGE">
<a>
<xsl:attribute name="href">#<xsl:value-of select="@LABEL"></xsl:value-of></xsl:attribute>
<xsl:value-of select="."></xsl:value-of>
</a>
</xsl:template>



You should post the input and required output correctly. Only then you could get a solution. Your question is not clear much.

prashob_2 February 18th, 2009 07:22 AM

What i need is to create an HTML output of my XML files using XSL..

Here in XML

<PAGE METAKEY="9781934043769" LABEL="146">
<INDENTPARA>There is no shortage of histor...</INDENTPARA>
...
</PAGE>
....
<INDEXITEM1><INDEXITEMCONTENT>industrial schools,</INDEXITEMCONTENT> <INDEXITEMPAGE METAKEY="9781934043769" LABEL="8">8</INDEXITEMPAGE> <INDEXITEMPAGE METAKEY="9781934043769" LABEL="128">128</INDEXITEMPAGE> <INDEXITEMPAGE METAKEY="9781934043769" LABEL="146">146</INDEXITEMPAGE></INDEXITEM1>

here INDEXITEM is a glossary

The attributes "LABEL" is referring to the page numbers.

What i want is to create an internal link between these to attribute values...so that i should be able to toggle between glossary items and the actual text.

The code provided by mrame is not working..

I hope what i explained is ok...

Thanks a lot in advance..

prashob_2 February 18th, 2009 07:24 AM

What i need is to create an HTML output of my XML files using XSL..

Here in XML

Code:

<PAGE METAKEY="9781934043769" LABEL="146">
<INDENTPARA>There is no shortage of histor...</INDENTPARA>
...
</PAGE>
....
<INDEXITEM1><INDEXITEMCONTENT>industrial schools,</INDEXITEMCONTENT> <INDEXITEMPAGE METAKEY="9781934043769" LABEL="8">8</INDEXITEMPAGE> <INDEXITEMPAGE METAKEY="9781934043769" LABEL="128">128</INDEXITEMPAGE> <INDEXITEMPAGE METAKEY="9781934043769" LABEL="146">146</INDEXITEMPAGE></INDEXITEM1>

here INDEXITEM is a glossary

The attributes "LABEL" is referring to the page numbers.

What i want is to create an internal link between these to attribute values...so that i should be able to toggle between glossary items and the actual text.

The code provided by mrame is not working..

I hope what i explained is ok...

Thanks a lot in advance..

mrame February 18th, 2009 07:32 AM

Even after repeated requests you are not posting the required output html for your input xml. Ok. Atleast post the incorrect html output obtained from my code and ask for the correct one you need. Then only you can get a solution.


All times are GMT -4. The time now is 05:06 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.