S
surflorida
hello,
I have two problems have I been hacking on for awhile looking in books
and web:
- getting the correct value of EMPTY emelement value:
in my dtd I have
!DOCTYPE foo [
<!ELEMENT foo (bar*)>
<!ATTLIST foo name CDATA #REQUIRED>
in my .xsl I have no problem getting value of name by using:
<xsl:value-of select="/foo/@name"/>
But in my EMPTY element dtd
<!ELEMENT bar( foo2,number )>
<!ELEMENT foo2 EMPTY>
<!ATTLIST foo2 code (A|B|C|D|E) #REQUIRED>
<!ELEMENT number (#PCDATA)>
<xsl:value-of select="/foo/bar/foo2/@code"
But since their are many <bar></bar>
it only appears to the value for the first code in foo and displays
it for the rest, e.g .xml file
<bar>
<foo2 code="A"/>
</bar>
<bar>
<foo2 code="B"/>
</bar>
..xsl
<xsl:for-each select="foo/bar">
<xsl:value-of select="/foo/bar/foo2/@code"
</xsl:for-each>
will display "A" for both not "A" and "B".
where foo is the grandparent of foo2.
- along the same lines
<!ELEMENT number (#PCDATA)>
where number is a real number 2,4,9000, etc... in my .xml file.
is their a function where I can get pass the number to javascript
function
in my .xsl file
I try things like:
onload checknumber"( <xsl:value-of select="number"/> )";
but cannot get the number.
<xsl:value-of select="number"/> alone will display the correct number.
thanks in advance.
I have two problems have I been hacking on for awhile looking in books
and web:
- getting the correct value of EMPTY emelement value:
in my dtd I have
!DOCTYPE foo [
<!ELEMENT foo (bar*)>
<!ATTLIST foo name CDATA #REQUIRED>
in my .xsl I have no problem getting value of name by using:
<xsl:value-of select="/foo/@name"/>
But in my EMPTY element dtd
<!ELEMENT bar( foo2,number )>
<!ELEMENT foo2 EMPTY>
<!ATTLIST foo2 code (A|B|C|D|E) #REQUIRED>
<!ELEMENT number (#PCDATA)>
<xsl:value-of select="/foo/bar/foo2/@code"
But since their are many <bar></bar>
it only appears to the value for the first code in foo and displays
it for the rest, e.g .xml file
<bar>
<foo2 code="A"/>
</bar>
<bar>
<foo2 code="B"/>
</bar>
..xsl
<xsl:for-each select="foo/bar">
<xsl:value-of select="/foo/bar/foo2/@code"
</xsl:for-each>
will display "A" for both not "A" and "B".
where foo is the grandparent of foo2.
- along the same lines
<!ELEMENT number (#PCDATA)>
where number is a real number 2,4,9000, etc... in my .xml file.
is their a function where I can get pass the number to javascript
function
in my .xsl file
I try things like:
onload checknumber"( <xsl:value-of select="number"/> )";
but cannot get the number.
<xsl:value-of select="number"/> alone will display the correct number.
thanks in advance.