This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: xsl-value-of does not process xsl values?


I'm not sure that the other responses to your question have clearly
addressed it, so I'll try.

The stylesheet processor responds to stylesheet instructions that are
located in the ***stylesheet***,  not anywhere else.  If you put something
that you think is a stylesheet instruction into the xml document that you
want to transform, it won't be treated as a stylesheet instruction, but only
like any other xml data.

There are several approaches you could take.

1) It is possible to combine an xml document and its stylesheet.  You have
to include a <stylesheet> element and there are some rules to follow to make
it work.

2) You could make a preliminary processing pass that creates a stylesheet,
then use that stylesheet to actually transform your document.  This is
possible but likely to be difficult to get working right.  Of course, it
takes another stylesheet to handle the first pass.

3) Think again about what you want to accomplish, and revise your xml file
design so that all the instructions are moved into the stylesheet.  If you
want to customize the handling, it is possible to import various other
stylesheets that can handle specific needs.  It is also possible to put all
kinds of customizing data into another xml file and get it using the
document() function.

What you can't do is to change the design of your stylesheet based on what
is in the source xml file.  The reason is that the stylesheet is compiled
before the transformation of your data is started.  This means you can't
decide what stylesheet to import based on the content of the xml document.

Cheers,

Tom P

[Phillip Rhodes]

> I have an xml document.  In this document, some of the element data is
> actually xsl.
>
> Example:
> <guide yearsOld="45">
> <text>You are <xsl:value-of select="/guide/@yearsOld"/> years old.</text>
> </guide>
>
> I do a transformation of this xml document, and I obtain the element
> content of the above element via another "xsl:value-of"
> Example: <xsl:value-of select="//text" />
>
> My problem is that the xsl is not being processed, it is treated as a
> string.  It is displayed literally as "<xsl:value-of
> select="/guide/@yearsOld"/>"  in my final transformed document.
>
> Can you tell me how I can fix this?
>



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]