This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

recursively descending through a node set to maintain white space integrity help!


hello list!

I am usilizing XSLT to transform a framed site into a flat site.
Currently im using XERCES-J/XALAN-J to develop the templates
but I intend to use XT to perform the final transform...

My approach basically involves collating node sets out of various source
documents.
It is however extremely important that I have tight control over the
transfer
of white space nodes and that this control not be transformation-engine
specific.

Therefore I have had to abandon the use of copy-of elements and recursively
called copy elements.

My first solution goes something like this...

<xsl:template name="copyCat">
	<xsl:variable name="whichDocument" select="$document" />
	<xsl:variable name="whichNode" select="$context" />
	<xsl:for-each select="document($whichDocument)/$whichNode/*">
		<xsl:element name="{name()}">
			<xsl:call-template name="getAttributes" />
			<xsl:call-template name="copyCat">
				<xsl:with-param name="context"><xsl:value-of select="."
/></xsl:with-param>
				<xsl:with-param name="documnet"><xsl:value-of select="$whichDocument"
/></xsl:with-param>
			</xsl:call-template>
		</xsl:element>
	</xsl:for-each>
</xsl:template>

<xsl:template name="getAttributes">
	<xsl:for-each select="self::node()/@*">
		<xsl:attribute name="{name()}"><xsl:value-of select="{name()}"
/></xsl:attribute>
	</xsl:for-each>
</xsl:template>

Basically I tell the copyCat template where to start and it outputs an
element foreach descendent to the
context node and recursively calls itself from within each output element...

I have yet to add the mechanism by which it will keep track of where the
context node, setting an id should work nicely...

Should I get to the question(s)?

My specific question regards XPATH!
I have tried several iterations of...

document($whichDocument)/$whichNode/*

including but not limited to...

document($whichDocument)/{$whichNode}/*;
document($whichDocument)/'$whichNode'/*;
document($whichDocument)/[*=$whichNode]/*;
document($whichDocument)/[.=$whichNode]/*;

accessing the document works...
(except the document seems to have to be in the same directory which
irritates me...
could be a XALAN-J problem?)

I cant access the path however... That's the problem!
Can anyone point me at a really good explanation of XPATH?

My second question has to do with my getAttributes template...
again my XPATH is lacking...

How do I select the value of the attribute currently being looped though?
As I understand I am selecting the node one time for each attribute it
contains...
Can I reference the "context attribute" in such a way as that I could
extract its value?

Thank you for any help in advance...

:: utah
:: digitalpulp
:: 220 East 23rd Street, Suite 1000
:: New York, NY 10010


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]