# XSLT Bug?

- Thread: https://externals.io/message/45883
- Original archive: https://news-web.php.net/php.internals/45883
- Started by Chris Jiang on 2009-10-28T08:14:51+00:00
- Messages: 1
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #45883 — Chris Jiang — 2009-10-28T08:14:51+00:00

URL: https://externals.io/message/45883#45883

Hi guys!

I don't know if anybody ever encountered a strange problem as I did, but
I've found a strange behavior of XSLT processor when I was working on my
project.

The case is simple, but weird, it just occasionally generates improper
result with the XML and XSL data I've inputted. Even worse, it happens
with out any sign or regular operation, which means I can't reproduce
this bug. With the same XML + XSL, it gives a perfect result sometimes,
but occationally, a buggy result.

My code was like the following:

XML:
...
<root>
  <a>1</a>
  <b>2</b>
</root>
...
XSL:
...
<script type="text/javascript">
<for-each select="/root/*">
  SomeHash.set('<xsl:value-of select="name()" />', <xsl:value-of
select="." />);
</for-each>
</script>
...

I was expecting something like this:
<script type="text/javascript">
  SomeHash.set('a', 1);
  SomeHash.set('b', 2);
</script>

However, the result could be such a mass sometimes, like:
<script type="text/javascript">
  SomeHash.set('a', 1b2;
</script>

I've been checking the XSL hundreds of times, and made sure it's bug
free. Plus, it transforms properly most of the time, but...

Anyone knows the reason? Is it a bug or something?

BTW: Did PHP 5 remove the Sab lib (xslt_create()) from it's default ext
build? I can't find more info about this ext nor a download of it now.

Thx!
