xsl-list
[Top] [All Lists]

linking each item to unique portions in the same page...more than just simple navigation in a document.

2003-06-29 11:53:28
Thank for your help.

Attached below are the XML and the XSL files i wrote. Is there a way to make
each correspoding field point to a description at the bottom. For example,
the textField_1 should be a link to a unique description below or the
textField_1_1 should point to its own description. Since i use
apply-templates for each textField or decimalField etc., i seem to have
trouble coming up with sepate links for textField_1 and textField1_1.

A good example for what i want to do is to look at the "Contract Name:
myWebservice" link in the output (HTML). When i click on it, it takes me to
short description section. I know how to work the html for that but what i
am confused about is that how would i be able to have separate links to all
items. For e.g I use:
<xsl:template name="HSString" match="//HSDataContainerType/HSString">
        <img src="texticon.gif"><xsl:value-of select="@name"/></img><br />
  </xsl:template>
to process all HSStrings. They could be textField_1 or textField_1_1. How do
i link each of them to unique portions in my code.
I want to do the same with every item such as textField_1, integerField_1,
DataContainer_1_1 etc etc. Once you see the output (html), it will be more
clear as to what i want.
Please let me know if you're confused as to what i'm asking. Appreciate your
help.

--Ahsan

XSL:

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
  <xsl:template match="HSContract">
    <html>
      <head>
        <title/>
      </head>
      <body>
        <p><a href="#desc"><b>Contract Name: </b><xsl:value-of
select="@contractName"/><br /></a>
                <b>ID: </b><xsl:value-of select="@id"/><br />
                <b>Start Date: </b><xsl:value-of select="@startDate"/><br /></p>
                <xsl:apply-templates select="*"/>
      </body>
    </html>
  </xsl:template>

  <xsl:template match="HSDocumentation">
        <p><a name="desc"><b>Short Description:</b><br /><br /></a>
        <xsl:apply-templates select="shortDescription" /><br /><br />
        <b>Long Description:</b><br /><br />
        <xsl:apply-templates select="descriptionSection" /></p>
  </xsl:template>

  <xsl:template name="shortDescription" match="//shortDescription">
        <xsl:value-of select="text()"/>
  </xsl:template>

  <xsl:template name= "descriptionSection" match="//descriptionSection">
        <xsl:value-of select="text()"/>
  </xsl:template>

 <!-- ******************************************************** -->
  <xsl:template match="HSDataContainerType">
    <b><img src="dcopenicon.gif"><xsl:value-of select="@name"/></img><br
/></b>
    <div style="margin-left: 3em;">
      <xsl:apply-templates select="*"/>
        </div>
  </xsl:template>
  <xsl:template match="*">
    <div><xsl:apply-templates select="HSString"/></div>
        <div><xsl:apply-templates select="HSDouble"/></div>
        <div><xsl:apply-templates select="HSInteger"/></div>
        <div><xsl:apply-templates select="HSDate"/></div>
        <div><xsl:apply-templates select="HSBinary"/></div>
        <div><xsl:apply-templates select="HSBoolean"/></div>
  </xsl:template>

   <xsl:template name="HSString" match="//HSDataContainerType/HSString">
        <img src="texticon.gif"><xsl:value-of select="@name"/></img><br />
  </xsl:template>

  <xsl:template name="HSDouble" match="//HSDataContainerType/HSDouble">
        <img src="decimalicon.gif"><xsl:value-of select="@name"/></img><br />
  </xsl:template>

  <xsl:template name="HSInteger" match="//HSDataContainerType/HSInteger">
        <img src="integericon.gif"><xsl:value-of select="@name"/></img><br />
  </xsl:template>

  <xsl:template name="HSDate" match="//HSDataContainerType/HSDate">
        <img src="dateicon.gif"><xsl:value-of select="@name"/></img><br />
  </xsl:template>

  <xsl:template name="HSBinary" match="//HSDataContainerType/HSBinary">
        <img src="binaryicon.gif"><xsl:value-of select="@name"/></img><br />
  </xsl:template>

  <xsl:template name="HSBoolean" match="//HSDataContainerType/HSBoolean">
        <img src="truefalseicon.gif"><xsl:value-of select="@name"/></img><br />
  </xsl:template>

</xsl:stylesheet>


XML:

<HSContract contractCategory="2" contractName="myWebservice"
contractType="3" expirationDate="Jun-23-2013" id="25_610_15006485306"
limitMaxConcurrentThreads="false" logEnabled="true" maxConcurrentThreads="2"
revision="25_11" runBatchInParallel="false" startDate="Jun-23-2003">
  <imagePath />
 <HSDataContainerType list="true" name="Inputs" required="true" revision=""
systype="true">
  <HSString name="textField_1" required="true" xmlNodeType="1" />
  <HSInteger name="integerField_1" required="true" xmlNodeType="1" />
  <HSDouble name="decimalField_1" required="true" xmlNodeType="1" />
  <HSDate isCacheKey="false" name="dateField_1" required="true"
xmlNodeType="1" />
  <HSBinary binaryEncoding="0" name="binaryField_1" required="true"
xmlNodeType="1" />
 <HSBoolean name="trueFalseField_1" required="true" xmlNodeType="1">
  <DefaultValue>false</DefaultValue>
  </HSBoolean>
 <HSDataContainerType name="DataContainer_1_1" required="true" revision="">
  <HSString name="textField_1_1" required="true" xmlNodeType="1" />
  <HSInteger name="integerField_1_1" required="true" xmlNodeType="1" />
 <HSDataContainerType name="DataContainer_1_1_1" required="true"
revision="">
  <HSString name="textField_1_1_1" required="true" xmlNodeType="1" />
  <HSInteger name="integerField_1_1_1" required="true" xmlNodeType="1" />
  </HSDataContainerType>
  </HSDataContainerType>
  </HSDataContainerType>
 <HSDataContainerType list="true" name="Outputs" required="true" revision=""
systype="true" />
 <HSDataContainerType name="Settings" required="true" revision=""
systype="true">
 <HSString name="HSUserId" systype="true" xmlNodeType="1">
  <DefaultValue />
  </HSString>
  <HSDataContainerType name="ServiceParameters" optionalOrigin="true"
revision="" systype="true" />
 <HSString name="HSLibName" systype="true" xmlNodeType="1">
  <DefaultValue />
  </HSString>
 <HSBoolean name="batchStopOnError" systype="true" xmlNodeType="1">
  <DefaultValue>true</DefaultValue>
  </HSBoolean>
 <HSDouble name="cost" systype="true" xmlNodeType="1">
  <DefaultValue>0.0</DefaultValue>
  </HSDouble>
 <HSInteger name="timeout" systype="true" xmlNodeType="1">
  <DefaultValue>0</DefaultValue>
  </HSInteger>
 <HSString name="locale" systype="true" xmlNodeType="1">
  <DefaultValue />
  </HSString>
 <HSString name="languageCode" systype="true" xmlNodeType="1">
  <DefaultValue />
  </HSString>
 <HSDataContainerType name="LibURIs" optionalOrigin="true" revision=""
systype="true">
 <HSString name="location" required="true" systype="true" xmlNodeType="1">
  <DefaultValue />
  </HSString>
 <HSBoolean name="enableAlternateLocations" required="true" systype="true"
xmlNodeType="1">
  <DefaultValue>false</DefaultValue>
  </HSBoolean>
  </HSDataContainerType>
  </HSDataContainerType>
 <HSDocumentation>
 <shortDescription>
 <![CDATA[ NextAxiom provides specialized expert services to application
vendors who plan to support integration of their products via Web services.
  ]]>
  </shortDescription>
 <descriptionSection title="myWebserviceDesc">
 <![CDATA[ NextAxiom consultants can provide critical initial guidance when
your team is about to undertake a major Web services implementation.
  ]]>
  </descriptionSection>
  <returnCodeDescription code="" />
  </HSDocumentation>
  </HSContract>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>