File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes XML and Related Technologies and the fly likes some question to Mr.Dmitry Kirsanov: Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "some question to Mr.Dmitry Kirsanov:" Watch "some question to Mr.Dmitry Kirsanov:" New topic
Author

some question to Mr.Dmitry Kirsanov:

Daniel Beck
Greenhorn

Joined: May 21, 2004
Posts: 12
Oh, a book about XSLT, that's really something I could need now for my Work! So, my questions about the XSLT 2.0 Web Development book:
1) What does can XSLT2 do better as XSLT ?
2) are there processor ready for XSLT2 (under linux, since thats the only platform I'm using?)
3) Something else about xslt : I've got a Problem, when extracting commentaries from an xslt file. I don't know why, using : <xsl:select="task/comment()">
<xsl:value-of="."/>
</xsl:select>
only extracts the first comment is under <task>. Why? And how can I change that ?

Daniel


Best regards<br />---> Daniel
Dmitry Kirsanov
Author
Ranch Hand

Joined: Apr 26, 2004
Posts: 33
1) I answered this question in another thread:

http://www.coderanch.com/t/126820/XML/Power-XSLT

2) Yes, use Saxon 7.* or 8.* (http://saxon.sf.net)

3) To access each comment under task, use either

<xsl:template match="task/comment()">

or

<xsl:for-each select="task/comment()">

Note: the exact XPath expression in the select attribute may depend on where you use the for-each, e.g. in a template with match="task" you only need select="comment()".
Daniel Beck
Greenhorn

Joined: May 21, 2004
Posts: 12
3) oh, I wanted to write <xsl:for-each> in my sample. I didn't take care.



the comment template lloks like that :



and then... even then using <xsl:for-each>, and I don't know why, xslt is only extracting the first commentary from the input file under /project/file/

what I want to do is : extract all comments from an ant build-file (these are xml files), and create an html file with anotation for all ant-targets with anotation (thats why I need to extract the commentaries) from that xml document - a little bit like javadoc.
do you know what is wrong in this code ?
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8898

Is there a java implementation of XSLT and if yes what is it called?
Thanks
[ July 15, 2004: Message edited by: Pradeep Bhat ]

Groovy
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8898

Dmitry

Does you book contain code samples?
Karthik Guru
Ranch Hand

Joined: Mar 06, 2001
Posts: 1209
Originally posted by Pradeep Bhat:
Is there a java implementation of XSLTThanks
[ July 15, 2004: Message edited by: Pradeep Bhat ]


the 2 prominent ones are xalan and saxon.
Dmitry Melnik
Ranch Hand

Joined: Dec 18, 2003
Posts: 328
Dmitry,

do you have any recommendations on designing XML schemata which make the resulting XML more suitable for XSLT processing? Is there such a thing as a well-formed XML file some pieces of which cause problems or even can not be processed with XSLT? Thanks.
Dmitry Kirsanov
Author
Ranch Hand

Joined: Apr 26, 2004
Posts: 33
Daniel: <xsl:for-each select="."> iterates only once, probably it's not what you have in mind. Make a template with match="comment()", and then inside the /project/target template, call it thus:

<xsl:apply-templates select="comment()">

No need to do any for-each; this will run the comment template on all children of the current node for whom the value of of comment() is true, i.e. for all comments.

Pradeep: in fact most XSLT implementations are written in Java: Saxon, Xalan, XT, jd-xslt...

Dmitry: XSLT is a programming language, so the question of "what XML is best for XSLT" has only one answer: that depends on how you program your stylesheet. The only requierement is that the source is well-formed so it can parse; other than that it's up to you. Your starting point is the structure and meaning of your data; design both your schema and your XSLT to best fit the data, not each other.
 
 
subject: some question to Mr.Dmitry Kirsanov:
 
Similar Threads
Book Promotion and Past Winners in XSLT
Can I do this with XSLT?
Namespaces are winding me up!
XMl to flatfile conversion
XSLT Task in ant gives waring "Warning: encoding "UTF-8" not supported, using UTF-8"