Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
| Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 30th, 2006, 05:11 AM
Authorized User
 
Join Date: Apr 2006
Location: NaviMumbai, Maharashtra, India.
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to vakorde
Default xsl element identification

Hi frnz,

I am stuck in accessing the value present in the element as below


<elephant:Title xmlns:elephant="elephant.1#">
An act to amend Sections 17024.5, 17052.6, 17072, 17077, 17085, 17131,
17132.5, 17140, 17140.3, 17144, 17152, 17220, 17250, 17250.5, 17255, 17256, 17279.4, 17501, 17551, 17731,

<?xm-insertion_mark_start author="conversion process" time="20050620T175447-0800"?>
17733, 18571, 18572, 18628, 18633, 18648, 19008, 19041.5, 19116,
19164, 19166, 19173, 19177, 19179, 19182, 19184, 19559, 23051.5,
23701s, 23701w, 23703.5, 23705, 23711, 23712, 24306, 24349, 24369.4,
24407, 24601, 24654, 24661.5, 24872, 24949.1, and 24949.3
</elephant:Title>


The problem with this element is that i want to have the values present in the structure <?xm-insertion_mark_start author="conversion process" time="20050620T175447-0800"?>
how do I identify this element? is it xm-insertion_mark_start ?
for accessing the value of the author shall i use, xm-insertion_mark_start@author?

Please help me in this. Thanks in advance.

__________________
---------------------------
Vikrant Korde
3i Infotech, Vashi,
Mumbai, Maharashtra, India.
 
Old April 30th, 2006, 10:17 AM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

If the context node is the elephant:Title element, then you can access the content of the processing instruction using the XPath expression processing-instruction(xm-insertion_mark_start)

You've chosen to structure the processing instruction as a set of keyword-value pairs rather like the attributes in an element start tag, but that's an application convention rather than something imposed by the XML spec. (These are sometimes called pseudo-attributes for that reason). There's nothing in XSLT that's designed to help you extract the values of the pseudo-attributes, though there's an extension function in Saxon if that's the processor you're using.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old May 1st, 2006, 02:18 PM
Authorized User
 
Join Date: Apr 2006
Location: NaviMumbai, Maharashtra, India.
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to vakorde
Default

Hey mhkay, it worked for me....

as faar as the pseudo atributes are concern i can got a way

<xsl:template match="processing-instruction('xm-deletion_mark')">

   <strike>
    <xsl:value-of select="substring-before(substring-after(current(), 'data=&quot;'), '&quot;')"/>
   </strike>

</xsl:template>

Thanks for timely help


 
Old May 1st, 2006, 04:06 PM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Yes, that's fine as a pragmatic solution. Just be aware that your syntax for pseudo-attributes is not quite as flexible as the syntax for real XML attributes - it doesn't allow apostrophe as a delimiter, and it doesn't allow spaces around the equals sign. You code could also fail if there is another pseudo-attribute more-data="here to confuse".

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old May 7th, 2006, 04:48 AM
Authorized User
 
Join Date: Apr 2006
Location: NaviMumbai, Maharashtra, India.
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to vakorde
Default

Hi Michael,

I agree with you on this point. Rather i was also thinking about the spaces around = sign. But other than this i haven;t found any solution. One more guidance i need in the conext of processing instructions itself.
the element that i have as a prcessing instructions is having the XML code in it. and now i want to process that value. i.e. apply templates.....
e.g. here is the code

<?xm-deletion author="procs" time="20010713T180850-1820"
data="&lt;elephant:Billva id=&quot;id_BC98D89B-2502-4225-&quot;
xmlns:elephant=&quot;http:gogle.comelephant.1#&quo t;
xmlns:xhtml=&quot;http://www.w3.org/1999/xhtml&quot;
xmlns:xlink=&quot;http://www.w3.org/1999/xlink&quot;&gt;&lt;eleph...ant:Num&gt;SEC.
10.&lt;/elephant:Num&gt;&lt;elephant:ActionLine action=&quot;IS_AMENDED&quot;
xlink:href=&quot;urn:elephant:codes:EDC:elephant#x pointer(%2Felephant%3AJokeDoc%2
Felephant%3ACode%2Felephant%3AJokeHeading%5B%40typ e%3D....."?>

In this code i could get the value of the data attribute
The next problem was to remove the &lt; and &gt; that was solved by a replace function.
The problem that i am faing now is that i need to again do something like <apply-temlated select="$variable"/>

this doesn't work, please help me in this matter.

Thanks in advance.

---------------------------
Vikrant Korde
3i Infotech, Vashi,
Mumbai, Maharashtra, India.




Similar Threads
Thread Thread Starter Forum Replies Last Post
XSL(T) problems with xsl:element pan69 XSLT 3 December 13th, 2007 06:24 AM
Using Variable for xsl:element Name Belch XSLT 5 November 2nd, 2007 04:28 AM
How to use xsl:element tag??? NewToXSL XSLT 2 June 8th, 2006 05:54 PM
Sorting element in xsl Sakubar Sathik XSLT 5 April 6th, 2006 04:23 AM
xsl:element not on its own line in output EstherMStrom XSLT 3 February 26th, 2005 06:08 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.