selecting raw xml using XSLT?

topic posted Tue, March 7, 2006 - 11:15 AM by  erraticBehavior
Hi Folks -

I'm a bit embarrased to post this question but here goes:

How do you select the raw xml using XSLT & XPath rather than the values of the nodes.
I'm combining two XML documents using XSLT, and thus far have only found ways to
select and insert the value of elements.

For instance, I want to take the entire "molecule" xml fragment (including all the child
xml) from a doc like this:
<?xml version="1.0" encoding="UTF-8"?>
<molecule>
<moleculeName>STEP_1</moleculeName>
<atom>
<atomNumber>1</atomNumber>
<atomName>C1</atomName>
<atomicNumber>6</atomicNumber>
<residueName>S5H</residueName>
<residueNumber>1</residueNumber>
<coordinates>
<x>-19.608999252319336</x>
<y>43.21200180053711</y>
<z>-15.092000007629395</z>
</coordinates>
<symUnique>true</symUnique>
</atom>
<atom>
<atomNumber>2</atomNumber>
<atomName>C2</atomName>
<atomicNumber>6</atomicNumber>
<residueName>S5H</residueName>
<residueNumber>1</residueNumber>
<coordinates>
<x>-18.284000396728516</x>
<y>42.928001403808594</y>
<z>-15.878000259399414</z>
</coordinates>
<symUnique>true</symUnique>
</atom>
</molecule>

...and insert it into another XML document that has the same molecule definition
in it.

I've used various permutations of the following xsl:
<?xml version = "1.0" encoding = "UTF-8"?>
<xsl:stylesheet version = "1.0" xmlns:xsl = "www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>

<xsl:template match="/">
<IN>
<RUN_TITLE>Methylene...1-A-1 state...RHF/STO-2G</RUN_TITLE>
<CONTRL>
<SCFTYP>RHF</SCFTYP>
<RUNTYP>OPTIMIZE</RUNTYP>
<COORD>UNIQUE</COORD>
</CONTRL>
<STATPT>
<STATPT_OPTTOL>1.0e-05</STATPT_OPTTOL>
<MOVIE>true</MOVIE>
</STATPT>
<BASIS>
<GBASIS>STO</GBASIS>
<NGAUSS>2</NGAUSS>
</BASIS>
<GUESS>
<GUESS_METHOD>HUCKEL</GUESS_METHOD>
</GUESS>
<SYMMETRY>
<GROUP>CNV</GROUP>
<NAXIS>2</NAXIS>
<XONE>0.0</XONE>
<YONE>0.0</YONE>
<ZONE>0.0</ZONE>
<XTWO>0.0</XTWO>
<YTWO>0.0</YTWO>
<ZTWO>0.0</ZTWO>
<DIRECT>PARALLEL</DIRECT>
</SYMMETRY>
<INITIAL_STATE>
<xsl:copy-of select="molecule"/>
</INITIAL_STATE>
</IN>
</xsl:template>
</xsl:stylesheet>

...but none actually inserts the molecule XML into the INITIAL_STATE element.

Any suggestions? (and thanks in advance!)

Steve
posted by:
erraticBehavior
Austin