
June 4th, 2004, 10:46 AM
|
|
Registered User
|
|
Join Date: Jun 2004
Posts: 1
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
XSL Help
Here's my problem to solve.
I've got an XML file structured like so:
Code:
<Root>
<Level_1>
<Title/>
<Data/>
<Level_2>
<Title/>
<Data/>
<Level_3>
...
</Level_3>
</Level_2>
</Level_1>
</Root>
The above file is actually a conglomeration of a DTD we've created and wordProcessingML (yes it's ugly, but that's what we've got to use given a requirement.) I don't know the exact structure of the XML files. I only know that basic framework defined by the DTD.
What I need to do is build a path reference (ie "Level_1_Title | Level_2_Title | Level_3_Title", etc) while I'm parsing the <Title/> nodes. I can select the correct node based on its parent, but I don't know how I can build a path. I have tried using a series of variables testing and storing the information in a variable like so:
Code:
<xsl:variable name="Level_1_Path">
<xsl:choose>
<xsl:when test="not(parent::ns0:Level2) and ../parent::ns0:Level1">
<xsl:copy-of select="."/>
</xsl:when>
<xsl:otherwise>
false
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
The only problem is I can't then use these variables to build the path because once the variable is assigned, <Title/> has already been parsed and it's onto the next element wiping out my variables when the next <Title/> comes around.
Any ideas?
|