[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

searching for occurrences of unique string-value and

Subject: searching for occurrences of unique string-value and replacing with string value of another node
From: Julie <julie.newcome@xxxxxxxxx>
Date: Thu, 5 Jun 2008 14:08:52 -0400
 searching for occurrences of unique string-value and
I've searched the archives, but I either haven't found anything that
would help with this or I haven't recognized what I should be looking
for!

What I have is an xml publication file that contains a list of File
elements. Each of these File elements outputs a different html file.
Within the html files there are optional related links. We use the
CuHistoryGuid element to identify these related links, the number for
which is generated dynamically by the database. Unfortunately, the
original programmer of our application agreed that these guids would
become the output filename and in fact they are not. Instead there is
another guid, generated by the File element, that is used as the
filename. What I need to do is use the stylesheet to search for the
unique value of the CuHistoryGuid, find it elsewhere in the file and
then go UP to the corresponding FileGuid and replace the value with
that. I was looking at using the key function, but it requires a
sub-node (if I understand it correctly) rather than an ancestor node.
Is there another way to accomplish this?

The xml looks roughly like this:

<PublicationContent>

   <File>
          <FileGuid>944f983d-110f-4d08-9c69-1e9f019228ac</FileGuid>
          <FileShortDescription>Help 1</FileShortDescription>
          <ContentUnit>
               <CuMetadata>
                      <BinaryType>no</BinaryType>
                      <CuHistoryGuid>CuHistoryGuid</CuHistoryGuid>
               </CuMetadata>
               <CuContent>
                      <Task>
                            <RelatedLinks>
                                     <CuRef
CuHistoryGuid="072aea44-573d-43b6-8a64-5cbd1ffccea8">Related link
text</CuRef>
                            </RelatedLinks>
                            (content, etc....)
         </ContentUnit>
     </File>



     <File>
          <FileGuid>e47267b0-7167-4cfd-a4c1-18dbb3a33b4d</FileGuid>
          <FileShortDescription>Help 2</FileShortDescription>
          <ContentUnit>
               <CuMetadata>
                      <BinaryType>no</BinaryType>

<CuHistoryGuid>072aea44-573d-43b6-8a64-5cbd1ffccea8</CuHistoryGuid>
(etc.)



Current template in xsl file:

<xsl:template match="RelatedLinks/CuRef">
     <a class="rt">
          <xsl:attribute name="href">
               <xsl:value-of select="@CuHistoryGuid"/><xsl:text>.html</xsl:text>
          </xsl:attribute>
     <xsl:apply-templates/>
    </a>
</xsl:template>



output is:

<p class="RelatedLinks">
     <a class="rt"
href="072aea44-573d-43b6-8a64-5cbd1ffccea8.html">Link Text</a>
</p>



Want the output to be:

<p class="RelatedLinks">
     <a class="rt"
href="e47267b0-7167-4cfd-a4c1-18dbb3a33b4d8.html">Link Text</a>
</p>


where the href equals the FileGuid for the file to which I want to link.



The CuRef element contains the CuHistoryGuid for which I would be
searching outside of this particular File element, but within the same
PublicationContent element.



I am using xmlspy , so their processor (but am definitely willing to
change to 2.0, this is just where we were when we started the
project):

XML Spy 2008 sp 2 (Enterprise edition)

XSL version: 1

Vendor: Altova GmbH

Vendor URL: http://www.altova.com



Thanks for any help!



Julie

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.