views:

70

answers:

2

Is there a problem with xml tags that have a dash in them??

I am trying to generate a pdf from and xsl and an xml..

I have the following for example:

<car>
  <name>toyotoa</name>
  <color-value>green</color-value>
</car>

In my xsl I have something like

<fo:inline font-weight="bold"> <xsl:value-of select="name" /> </fo:inline>

this prints the correct value in the pdf

if I try to print the second tag (color-value) .. nothing is printed in the pdf.. as if it can't read that node.

<fo:inline font-weight="bold"> <xsl:value-of select="color-value" /> </fo:inline>

this returns nothing..

However when I do the test in eclipse and run the xsl as xsl tranformation .. the output file correctly displays both values. Only in the pdf does it only display the first one.

Any clues on what might be going on?

EDIT Can I somehow debug by trying to list all the values of the tags under the car node? maybe that will give me some hints. ?

EDIT 2 Looks like the problem occurs at the velocity template not the xls

EDIT 3 found the solution after checking the method called by the velocity template for generating the value of car-color.. apparently there was an inheritence isssue and the value was not even inserted in the xml for the tranformation.

+1  A: 

you need to close the select attribute in the second example.

Paul Butcher
sorry it is closed in the actual xsl just a bad edit on my part in the question
Ayrad
Is it definitely in the correct context? (I imagine so, if running it as XSLT works).
Paul Butcher
yes and it displays the first value (name) correctly.. the next output statement returns nothing for the the node following it directly.. I'm thinking something went wrong during the generation of the xml
Ayrad
A: 

I'm sorry if this is not a complete answer, but it seems to me, that escaping might be the issue here. The XSLT standard seems to suggest, that the value of the select attribute is an expression, that might see the dash as a subtraction (as in value of the element color minus the value of the element value). I have no idea though, how to fix this.

nfechner
thanks for the answer but I tried with just <color> and I get the same issue
Ayrad