xml-xalan-j-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Ludwig <mil...@gmx.de>
Subject Re: xml with dots in tags
Date Tue, 01 Dec 2009 13:19:42 GMT
Marc Ende schrieb am 01.12.2009 um 10:39:20 (+0100):

> But within the source-xml they've got '.' in the tags. For example:
> 
> <root.element>
>   <test.element>Hello World</test.element>
> </root.element>

There's nothing unusual at all with that.

> If I try to access the value with such xslt I got nothing:
> 
> <xsl:template match="/">
>   <test><xsl:value-of select="root.element/test.element"/></test>
> </xsl:template>

Works fine for me. Did you apply the stylesheet to the correct input?

> I tried to escape the dots in the select with '\.' but that doesn't
> work.

It doesn't because you must not prefix the dot with a backslash. XPath
does not follow the same rules as grep, or the shell, or Perl.

> In XPath there was the . mentioned as a replacement for a character.
> So it should also work on '.' I think.

Don't know what you mean, but "." is the current context node.

> By the way. Is there any way to 'copy' parts of one xml in the other
> xml within the transformation?
> It would be helpful if there are parts which doesn't need to
> transformed (just copied).

I think you're looking for the standard pattern called "modified
identity transform". Googling for that will teach you the concept.
It's not difficult and really practical.

Best,
-- 
Michael Ludwig

Mime
View raw message