• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

some question to Mr.Dmitry Kirsanov:

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Author
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1) I answered this question in another thread:

https://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
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ?
 
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there a java implementation of XSLT and if yes what is it called?
Thanks
[ July 15, 2004: Message edited by: Pradeep Bhat ]
 
Pradeep bhatt
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dmitry

Does you book contain code samples?
 
Ranch Hand
Posts: 1209
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Ranch Hand
Posts: 328
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
reply
    Bookmark Topic Watch Topic
  • New Topic