Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old August 11th, 2006, 07:15 PM
bignass04@gmail.com
Guest
 
Posts: n/a
Default XPath as XML attribute

Hi all,

I'm a newbie to XSLT working on my first project with it and I'm stuck
on a particular thing.
I want to create a document that will write the PCDATA from a given
<Lineelement, then, in the next table cell, I want to insert the text
within the element pointed to by the "xpath" attribute.
<Line num="1" xpath="Income/Additions/CashFlow">Cash Flow for
2005</Line>
<Line num="2" xpath="Additions/AddDeductions/Total">Total Deductions
for 2005</Line>
<Line num="3"
xpath="Additions/AddDeductions/InterestPaidCorporateStockhold">Interest
paid to all corporations</Line>

I've tried
<xsl:for-each select=".">
<td>
<xsl:value-of select="@xpath" />
</td>
</xsl:for-each>
but it only outputs the text as PCDATA rather than retrieving the text
in the XML element. Is there any thing I can do to have the attribute
act as an XPath expression?

Thanks

  #2  
Old August 12th, 2006, 06:45 PM
Martin Honnen
Guest
 
Posts: n/a
Default Re: XPath as XML attribute



bignass04@gmail.com wrote:

Quote:
Is there any thing I can do to have the attribute
act as an XPath expression?
Not with XSLT/XPath 1.0 as standardized, you have to look at extensions
which are then not necessarily implemented by the XSLT processor you use.
EXSLT.NET (<http://www.xmlmvp.org/exslt/index.html>) has this extension
function
<http://www.xmlmvp.org/exslt/GDNDynamic-evaluate.xml>
thus if you use .NET and are able to install EXSLT.NET then you can use
that function.

If you can't use an extension function then your only way with standard
XSLT is to generate a new stylesheet and then apply it.


--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
  #3  
Old August 22nd, 2006, 04:35 PM
bignass04@gmail.com
Guest
 
Posts: n/a
Default Re: XPath as XML attribute

If you can't use an extension function then your only way with standard
Quote:
XSLT is to generate a new stylesheet and then apply it.
I took your advice and I've written a stylesheet that generates a
stylesheet but (and correct me if I'm wrong) I was assuming that the
XSLT stylesheet that I wrote would generate the stylesheet which would
in turn generate an html document. I've written a stylsheet but all it
does it transform it into another stylesheet, it doesn't automatically
turn it into HTML. Is there some kind of instruction that you
specifically have to give in order to make the stylesheet execute
twice? Thank you.

Martin Honnen wrote:
Quote:
bignass04@gmail.com wrote:
>
>
Quote:
Is there any thing I can do to have the attribute
act as an XPath expression?
>
Not with XSLT/XPath 1.0 as standardized, you have to look at extensions
which are then not necessarily implemented by the XSLT processor you use.
EXSLT.NET (<http://www.xmlmvp.org/exslt/index.html>) has this extension
function
<http://www.xmlmvp.org/exslt/GDNDynamic-evaluate.xml>
thus if you use .NET and are able to install EXSLT.NET then you can use
that function.
>
If you can't use an extension function then your only way with standard
XSLT is to generate a new stylesheet and then apply it.
>
>
--
>
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles