Hello,
I just this question: -
<xsl:for-each select="//tag1">
-
<xsl:value-of select="text()" />
-
</xsl:for-each>
-
my output is:
hello;world;
I need:
Hello;
World;
my xslt header is: -
<xsl:output method="text"
-
encoding="iso-8859-1"
-
indent="yes"
-
My output file is a text file.....
How can I do this, please?
Best regards,
16 3939
You can concatenate text() with line feed entity "
". - <xsl:template match="/">
-
<xsl:for-each select="//tag1">
-
<xsl:value-of select="concat(text(), '
')"/>
-
</xsl:for-each>
-
</xsl:template>
hi thanks,
what do you think if I add it inside a text tag? is this better or not? - <xsl:text>>
</xsl:text>
sometimes I need to do this too: - <xsl:text>>printf("hello");
</xsl:text>
or indent the braces: - <xsl:text>> } 
</xsl:text>
What do you suggest for these aims?
Thanks,
I think it's absolutely normal, but variant with concatenation is more readable than your. Compare: -
<xsl:value-of select="concat( 'your_text', text(), '> } ', some_tag_value, 'your_text2')"/>
-
and -
<xsl:text>your_text</xsl:text><xsl:value-of select="text()/><xsl:text>> } </xsl:text><xsl:value-of select="some_attrib_value"/><xsl:text>your_text2</xsl:text>
-
thanks,
seem ok, but the function concat(), where I can find explanation about other function too?
Why doens't these below work? -
indent="yes"
-
xalan:indent-amount="2"/>
-
It's xalan specific instruction. I think U need to read some docs about it. )
Thanks; a further question if possible....
The text in the xml contains this string inside a tag: "hello\nworld" (and I mean not the new line but the '\' follow by 'n' -
<xsl:value-of select="concat( 'PRINT(', text(), ');' />
-
//produce in the output file:
-
PRINT(hello\nworld);
-
while I need in the output text file: -
PRINT(hello);
-
PRINT(world);
-
How can I do this, please?
<xsl:value-of select="concat( 'PRINT(',
replace(text(), '\n', 
),
');' />
<xsl:value-of select="concat( 'PRINT(',
replace(text(), '\n', 
),
');' />
hello,
it seems there's a problem to put the "(" ")" of replace inside a concat......Do you know it? Is there any trick, please?
thanks,
- <xsl:value-of select="concat( 'PRINT(',
-
replace(text(), '\n', ),
-
');' "/>
I forgot double quote at the end of "select" attribute. And you just need to pay attention to the code and read more docs ))
- <xsl:value-of select="concat( 'PRINT(',
-
replace(text(), '\n', ),
-
');' "/>
I forgot double quote at the end of "select" attribute. And you just need to pay attention to the code and read more docs ))
Hello, I don't understand: my code is this -
<xsl:value-of select="concat(' doc.print(',
-
replace(text(), '\n', '
' ), ');
');" disable-output-escaping="yes" />
-
now I'm editing it with .Net and it says that replace() isn't xslt function....
Is it ok ,please?
mm I haven't still done this thing; I can't understand how to do the replace() (in my case) with xslt 1.0....any suggests....
I remember...my output file output: -
print(hello\nworld); //"hello\nworld" is the result of text() xslt function
-
Instead I need: -
print(hello);
-
print(world);
-
That is: xslt should looks into text() and break the string when it sees a '\n';
thanks.
Could you post your input? It might really help to clear things up. I feel like we're forcing an error down a crooked path.
-
<root>
-
<htmltag><![CDATA[<html>\n<body>]]></htmltag>
-
<text><![CDATA[This is a text node]]></text>
-
<htmltag><![CDATA[.\n</body>\n</html>]]></htmltag>
-
</root>
-
This is my xml; with xalan and a xslt (as you read before) I have to produce: -
print(<html>);
-
print(<body>);
-
...................
-
at the moment it produce:
THe problem is that '\n' (and at this point the fact that xalan use xslt 1.0 and doens't know replace() )
Are you understand? I dont' understand how write the replace in xslt 1.0....
- <xsl:template name="globalReplace">
-
<xsl:param name="outputString"/>
-
<xsl:param name="target"/>
-
<xsl:param name="replacement"/>
-
<xsl:choose>
-
<xsl:when test="contains($outputString,$target)">
-
<xsl:text>print(<xsl:text>
-
<xsl:value-of select=
-
"concat(substring-before($outputString,$target),
-
$replacement)"/>
-
<xsl:text>);<xsl:text>
-
<xsl:call-template name="globalReplace">
-
<xsl:with-param name="outputString"
-
select="substring-after($outputString,$target)"/>
-
<xsl:with-param name="target" select="$target"/>
-
<xsl:with-param name="replacement"
-
select="$replacement"/>
-
</xsl:call-template>
-
</xsl:when>
-
<xsl:otherwise>
-
<xsl:text>print(<xsl:text>
-
<xsl:value-of select="$outputString"/>
-
<xsl:text>);<xsl:text>
-
</xsl:otherwise>
-
</xsl:choose>
-
</xsl:template>
-
Put the corresponding print text around anywhere where you output the text.
target is '\n', replacement is '' (empty string)
hello,
there is a problem: $outputString; I suppose I have to set this via Xalan (in java code); but as you can see in my previous code I use text();
With xalan I can do :
trasformer.setParameter("target", '\n' );
trasformer.setParameter("replacement", "" );
but only this and not other...
Are you understand, plese?
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Marcel |
last post by:
Hello all,
I am working on a generic (php) script to produce (X)HTML Forms through XML
and XSL based on field-definitions stored in a database.
The basic way i did HTML-forms in PHP was like...
|
by: Spam sucks |
last post by:
hello,
i create a logging xml file with dom that could have an unknown count of
results now it is 0 to 7 but it could be i have 14 or 50 results how can you
read this out with xsl, with php you...
|
by: Tjerk Wolterink |
last post by:
Hello,
I want to create m elements in this form:
<element index="n"/>
Where n = 1 2 .. m
Can is do this with an xsl:for loop??
And if so how
|
by: Tjerk Wolterink |
last post by:
I posted my problem earlier, but i simplified the examples,
and i know what the cause of the problem is, but i dont know the solution,
my xml file:
<?xml version="1.0" encoding="ISO-8859-1"?>...
|
by: Dirk McCormick |
last post by:
I need to transform something that looks like this
<!-- %%%%%%%%%%%%%%%%%%%%%%% -->
<MyStructure>
<Packages>
<Package>
<PkgBenefitCode>1</PkgBenefitCode>
<PkgBenefitCode>2</PkgBenefitCode>...
|
by: rene |
last post by:
Hello everybody,
i have these 2 xml files
------1.xml------
<?xml version="1.0" encoding="UTF-8"?>
<root>
<element>1</element>
<element>2</element>
</root>
|
by: George Durzi |
last post by:
Bear with me on this one because the explanation might be a bit lengthy. I
have a stored procedure which is returning three tables (using three
SELECTs).
Table 0 is a list of all bills for a job...
|
by: nutsmuggler |
last post by:
Hi.
I am using xml to store my annotations.
here is my document (a part of it):
<?xml version="1.0" encoding="UTF-8"?>
<text title="Finnegan's wake">
<book number="1">
<chapter number="5">...
|
by: Andrus |
last post by:
xml data
<?xml version="1.0" ?>
<statement>
<accounts>
<account number="22">
<currency symbol="USD">
<transactions>
<transaction>
<id>1</id>
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
| |