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]
Other format: [Raw text]

Please help: Transforming a node and retrieving siblings + ancestors


Hello,

I am using Java and Xalan-J 2 xslt engine. I would like to know I could do this:

Let's say I have the following xml:
<?xml version="1.0" ?>
<root prop="try to get this">
<childone>or try get this text</childone>
<childtwo><childtwoone>test text</childtwoone></childtwo>
<childthree></childthree>
</root>
--

And let's also assume that we've got this in DOM model object with childtwooneNode representing the 'childtwoone' tag and rootNode representing the 'root' element:

Transformer transformer = TransformerFactory.newInstance().newTransformer(new StreamSource("c:\\temp\\somexslfile.xsl"));
transformer.transform(new DOMSource(childtwooneNode), new StreamResult(System.out));
--

Now in my xsl file how do I go about retrieving text from the 'childone' tag or the root's attribute 'prop'.

I was able to do this using Microsoft XML 3 parsers just fine by using the following for example:
<xsl:value-of select="../childone" />
--

The reason childtwoone node needs to be fed into the transformation is b/c it's the node that most of the data comes from, but there are (smaller yet some!) pieces of information that come from the rest of the document.

I would really really be greatful if someone could tell me how I could get this working. An example would be great!


Thanks for the help in advance,
Sean S.

_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com


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]